Migrations¶
Schema changes are explicit. Generating a model does not silently create tables in an existing database.
fexu generate model Book --app catalog
fexu migrate make initial --app catalog
fexu migrate plan
fexu migrate up
fexu migrate status
Files: app-specific migrations appear under apps/catalog/migrations/; framework migrations are handled by the framework migration workflow.
Everyday workflow¶
- Edit the model in
apps/catalog/models/book.rs. - Generate a migration with
fexu migrate make name --app catalog. - Inspect the generated schema change and
fexu migrate plan. - Back up an existing database before applying changes.
- Apply with
fexu migrate upand inspectfexu migrate status.
Adding a required column to a populated table requires a deliberate backfill:
fexu migrate make add_stock --app catalog --backfill books.stock:i64=0
fexu migrate plan
fexu migrate up
Rename operations use fexu migrate rename-column and fexu migrate rename-table. A rollback may require special flags depending on the migration; inspect fexu migrate down --dry-run before changing persisted data. For all supported flags, see CLI reference.