Compare and generate
The baseline DB selector only includes connections where every migration is applied. Sonamu compares that databaseโs schema with the Entity definitions and previews the changes and generated code.- Select a baseline database.
- Expand generated code with the button beside a file, or use Expand all to review every file.
- Select Generate migrations to create the files.
Migration status
Rows are migration files and columns are database connections. Each cell showsAPPLIED or PENDING. Connections load independently, so a slow or failed database does not block other columns.
Sonamu UI only shows and runs the
development, test, and fixture connections. The UI API rejects staging and production, so run those migrations with the sonamu migrate CLI.- Select an execution target by clicking its column header or cells.
- Enable Details to show the host, database, remote marker, and per-column refresh action.
- Select an Error badge to inspect the server error.
- The first button beside a file expands its code on the page. The second opens the file in VS Code, Cursor, or Zed.
Apply latest
Apply latest runsknex.migrate.latest() for each selected database in order. Files applied to one database remain in one Knex batch.
The execution dialog has these stages:
- Review the targets and Pending files, and choose whether to run Shadow validation.
- Approval requests Slack approval for configured remote targets and checks it every two seconds.
- Apply displays per-file progress and per-database completion.
Rollback
Rollback ignores migration-file row selection and rolls back the entire latest Knex batch on each selected database. Knex runs the batchโsdown() functions in reverse order.
Because this is destructive, the first click only arms the Rollback button and changes its confirmation text. The second click starts the operation. If a file fails, execution stops at that file. The rollback transaction is canceled, so the database may appear unchanged. Rollbacks run from the latest migration backward, so execution cannot continue to the next rollback after a failure in the middle.
When the selection includes a remote database that requires Slack approval, Rollback requests approval first, just like Apply. The request includes each targetโs latest batch number, so an Apply approval or an approval for an earlier batch cannot start a rollback.
Next steps
Scaffolding Tab
Generate Model code
migrate CLI
Manage migrations from the CLI