Migration Workflow¶
Run Schemage without arguments to calculate a migration plan and confirm execution:
vendor/bin/schemage
Example:
Migration plan
3 operations:
- Add column `phone` to `users`
- Drop index `old_index` from `posts`
- Add index `new_index` on `posts`
Apply changes? [y/N]:
Dry run¶
vendor/bin/schemage --dry-run
Displays the migration plan and generated SQL without executing it.
Apply without confirmation¶
vendor/bin/schemage --yes
This works for migrations that do not require force.
For a non-interactive destructive migration:
vendor/bin/schemage --yes --force
Driver planning¶
The diff engine produces logical operations. Before SQL generation, Schemage may pass them through a driver-specific operation planner.
For example, SQLite converts unsupported column and foreign-key alterations into a single RecreateTable operation.
Convergence¶
After a migration is applied successfully, running Schemage again against the same schema should report:
Database is up to date.
This idempotence is a core correctness requirement of the diff engine and introspectors.