dbx-regenerate

Regenerates Go code from DBX schema files and validates compilation.

3.3k|427|Updated Apr 4, 2018
One-click install
npx skills add https://github.com/storj/storj --skill dbx-regenerate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dbx-regenerate
Source: https://github.com/storj/storj/tree/main/.claude/skills/dbx-regenerate
Command: npx skills add https://github.com/storj/storj --skill dbx-regenerate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

After modifying .dbx schema files in the Storj satellite database layer, developers must manually regenerate the large satellitedb.dbx.go file, verify the diff, and confirm the code compiles, which is repetitive and error-prone.

Core Features & Use Cases

  • Automated Code Generation: Runs the DBX compiler via go generate to produce type-safe Go code for PostgreSQL and CockroachDB from .dbx schema files.
  • Diff Summary and Validation: Shows what changed in the generated file and verifies the output compiles with go build.
  • Error Diagnosis: Explains common DBX errors such as syntax errors, duplicate definitions, invalid field types, and missing primary keys with suggested fixes.
  • Use Case: After adding a last_login field to user.dbx, run this Skill to regenerate the code, review the new Update methods, confirm compilation, and get reminded to create a database migration.

Quick Start

Regenerate the DBX code for my modified schema files and show me what changed.

Frequently Asked Questions about dbx-regenerate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I regenerate DBX code after changing .dbx schema files?

Run go generate inside the satellite/satellitedb/dbx directory to recompile all .dbx schema files into satellitedb.dbx.go. Then use git diff to review changes and go build ./satellite/satellitedb/dbx to confirm the generated code compiles.

What is DBX in the Storj codebase?

DBX is Storj's schema-first ORM that generates type-safe Go database code from .dbx schema files. It produces CRUD methods, model structs, and separate implementations for PostgreSQL and CockroachDB from a single schema definition.

Why does DBX generation fail with a parse or syntax error?

Syntax errors usually come from missing commas between fields, invalid field type names, or incorrect query syntax in a .dbx file. Check the line number referenced in the error and verify the field type is one of the valid DBX types like text, int64, bool, or timestamp.

Does DBX support both PostgreSQL and CockroachDB?

Yes, DBX generates backend implementations for both PostgreSQL and CockroachDB from the same .dbx schema files. The generated satellitedb.dbx.go file contains separate code paths for each database backend.

What should I do after regenerating DBX code?

Review the git diff to confirm the generated changes match your schema edits, then create a database migration if the schema changed. Run the linter on the dbx package and commit the .dbx changes together with the regenerated code.