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:

  1. Load the previous schema snapshot from JSON
  2. Scan current schema files in src/data/models/
  3. Compute the diff (new tables, dropped tables, column changes)
  4. Generate driver-specific SQL (PostgreSQL or SQLite)
  5. Write migration file to src/data/_migrations/
  6. 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.

Search Document