Regenerate DBX code after making changes to .dbx schema files. Runs code generation, shows diff summary, validates compilation, and reports any errors.
You are helping regenerate the DBX-generated code after changes to .dbx schema files.
DBX (Database Extension) is Storj's schema-first ORM that generates Go code from .dbx schema files. When developers modify .dbx files in satellite/satellitedb/dbx/, the generated code in satellitedb.dbx.go must be regenerated.
This skill:
Follow these steps to regenerate DBX code:
First, check which .dbx files have been modified (optional but helpful for context):
git status satellite/satellitedb/dbx/
This helps understand what schema changes triggered the regeneration.
Execute the code generation:
cd satellite/satellitedb/dbx && go generate
This runs the DBX compiler which:
satellitedb.dbx.go fileExpected output: Should see messages about code generation progress.
After generation completes, show a summary of what changed:
git diff --stat satellite/satellitedb/dbx/satellitedb.dbx.go
Also show a preview of the changes:
git diff satellite/satellitedb/dbx/satellitedb.dbx.go | head -100
What to look for:
Create_, Get_, Update_, Delete_ methods)Ensure the generated code compiles successfully:
go build ./satellite/satellitedb/dbx
If compilation succeeds, the regeneration was successful.
Provide a clear summary to the user:
If successful:
users table")If errors occurred:
Error pattern: parse error, unexpected token, invalid syntax
Cause: Incorrect .dbx syntax (missing commas, invalid field types, etc.)
Fix:
Error pattern: already defined, duplicate definition
Cause: Model or query defined multiple times across .dbx files
Fix:
Error pattern: unknown type, invalid type
Cause: Using a field type that DBX doesn't recognize
Valid DBX types:
text, blob, int, int64, uint, uint64bool, timestamp, float64utimestamp (microsecond timestamp)Fix: Change the field type to a valid DBX type
Error pattern: no primary key defined
Cause: Table definition missing a primary key
Fix: Add a primary key using ( key <field> ) in the model definition
Error pattern: invalid query, unknown read pattern
Cause: Using an incorrect query pattern name
Valid patterns:
read one, read all, read first, read paged, read limitoffset, read scalarupdate, delete, create, countFix: Use a valid query pattern from the list above
Error pattern: circular dependency, import cycle
Cause: .dbx files referencing each other in a circular way
Fix: Restructure the models to remove circular references
After successful regeneration, remind the user to:
make llint LINT_TARGET=./satellite/satellitedb/dbx
The satellitedb.dbx.go file contains:
User_Id_Field)WithTx() methods for transactionsUser modified: satellite/satellitedb/dbx/user.dbx - added last_login timestamp field
Regeneration output:
DBX regenerated successfully!
Changes:
- Modified: User model (added field: last_login)
- New methods: Update_User_LastLogin_By_Id
- Lines changed: +156 -12
Generated methods:
- User.LastLogin field added
- User_LastLogin_Field type added
- Update methods now include last_login in optional fields
Compilation: ✓ Success
Next steps:
1. Review the diff to ensure changes are correct
2. Create a migration to add the last_login column
3. Run tests to ensure compatibility
satellite/satellitedb/dbx/gen/main.goerrs.Class("satellitedb")git diff to see exactly what changed before committingOpenProse VM skill pack. Activate on any `prose` command, .prose files, or OpenProse mentions; orchestrates multi-agent workflows.
Control Philips Hue lights and scenes via the OpenHue CLI.
Notion API for creating and managing pages, databases, and blocks.
Transcribe audio via OpenAI Audio Transcriptions API (Whisper).
Query Google Places API (New) via the goplaces CLI for text search, place details, resolve, and reviews. Use for human-friendly place lookup or JSON output for scripts.
Capture and automate macOS UI with the Peekaboo CLI.
Category:developer