Skip to main content

Module migration

Module migration 

Source
Expand description

Schema migration types and traits.

The migration subsystem lets compiled #[derive(Table)] schemas evolve across releases without manual stable-memory surgery. The flow is:

  1. On boot, the DBMS compares the hash of every compiled TableSchemaSnapshot against the hash stored in the schema registry.
  2. If they differ, the DBMS enters drift state and refuses CRUD.
  3. The user calls Dbms::migrate(policy), which diffs the stored snapshots against the compiled ones and produces a Vec<MigrationOp>.
  4. The ops are applied transactionally; on success the new snapshots and schema hash are persisted and the drift flag is cleared.

This module owns the types (MigrationOp, ColumnChanges, MigrationPolicy, MigrationError) and the per-table extension hook Migrate. The diff algorithm and apply logic live in the engine crate.

Structs§

ColumnChanges
Bundle of constraint-flag deltas for an MigrationOp::AlterColumn.
MigrationPolicy
Caller-supplied policy that gates destructive migration ops.

Enums§

MigrationError
Error variants produced by the migration planner and apply pipeline.
MigrationOp
Single atomic step produced by the migration planner.

Traits§

Migrate
Per-table extension hook for schema migrations.