Skip to main content

Module migrations

Module migrations 

Source
Expand description

Schema migration runner for mempill-sqlite.

Applies versioned DDL to a rusqlite Connection in a deterministic, idempotent manner. Schema version is tracked via SQLite’s built-in user_version PRAGMA.

§Intended PRAGMA environment (applied at connection open in connection.rs)

  • PRAGMA journal_mode=WAL; — write-ahead log for concurrent reads during writes
  • PRAGMA synchronous=FULL; — full durability (mandatory; WAL+NORMAL can lose writes on power loss)
  • PRAGMA foreign_keys=ON; — enforce FK constraints defined in DDL

Enums§

MigrationError
Migration error wrapper.

Constants§

CURRENT_SCHEMA_VERSION
The target schema version this runner brings the database to. Increment this constant (and add a new migration step) for every future DDL change.

Functions§

apply_migrations
Apply all pending migrations to conn up to CURRENT_SCHEMA_VERSION.