glimr/db/gen/migrate
Migration Generator
Compares current schema definitions against a stored snapshot to detect changes and automatically generate migration SQL.
The workflow is:
- Load the previous schema snapshot from JSON
- Scan current schema files in src/data/models/
- Compute the diff (new tables, dropped tables, column changes)
- Generate driver-specific SQL (PostgreSQL or SQLite)
- Write migration file to src/data/_migrations/
- Update the snapshot for next run
Supports column renames via the rename_from modifier, which
is automatically cleaned up after migration generation.
Run with: gleam run -m glimr/db/gen/migrate
Values
pub fn main() -> Nil
Main
Entry point for the migration generator CLI.
Run with: gleam run -m glimr/db/gen/migrate
pub fn run(model_filter: option.Option(List(String))) -> Nil
Run
Run migration generation with an optional model filter. When a filter is provided, only those models are scanned and the snapshot is merged rather than replaced.