moonbitstack/moonorm/examples/19-migrations does not have a README file

    SchemaLog

    type SchemaLog

    Versioned schema migrations (Alembic / Diesel-migrations): a Migration bundles a version with its forward (up) and reverse (down) statements; a Migrator records applied versions in a bookkeeping table and drives the schema forward (up, applying only what is pending — idempotent) or back (down_to). current_version and applied_versions report state. Everything travels through the @moondb.Driver seam, so the same Migrator runs on any backend. The driver here is a small double modelling the schema_migrations bookkeeping table, so the whole example stays backend-free and compiles on every target; against real SQLite/Postgres the Migrator is identical.

    moon run examples/19-migrations

    The bookkeeping table the Migrator maintains, in memory. It interprets exactly the statements Migrator issues against schema_migrations (defined in migrations.mbt) — the version INSERT/DELETE and the two version SELECTs — and treats every other statement (the migrations' own DDL) as an applied no-op it need not model.

    Source Files