Skip to main content

Module migration

Module migration 

Source
Expand description

Migration engine — model snapshot diffing, migration generation, and history tracking.

Corresponds to EFCore’s migration system. Implements full model diffing:

  • Detect added/removed tables
  • Detect added/removed/altered columns
  • Generate Up/Down SQL with dialect-specific type mappings
  • Maintain __ef_migrations_history tracking table

Structs§

Migration
Represents a single migration with up/down SQL scripts.
MigrationEngine
The migration engine — compares old and new model snapshots to generate migration SQL.
MigrationHistoryEntry
Represents a record in the migration history table. Table name: __ef_migrations_history Corresponds to EFCore’s __EFMigrationsHistory.
MigrationStore
Reads and writes migration scripts on disk.
ModelSnapshot
A snapshot of the entity model at a point in time. Corresponds to EFCore’s ModelSnapshot.
SnapshotCheck
A CHECK constraint in a model snapshot.
SnapshotColumn
Serialized form of PropertyMeta for snapshot storage.
SnapshotEntityType
Serialized form of EntityTypeMeta for snapshot storage.
SnapshotForeignKey
A composite foreign key in a model snapshot.
SnapshotIndex
A declared index in a model snapshot.
SnapshotIndexColumn
One key part of a snapshot index.
SnapshotTableOptions
MySQL table options in a model snapshot.

Enums§

MigrationDialect
Specifies the database SQL dialect for migration generation.

Constants§

MIGRATION_HISTORY_TABLE
Table name for migration history.
PRODUCT_VERSION
Product version recorded in migration history.

Functions§

build_registered_snapshot
Builds a ModelSnapshot from all inventory-registered entities and #[entity(T)] configurations for context_key.
create_migration_history_table_sql
SQL to create the migration history table.
parse_model_snapshot_json
Parses a model snapshot JSON file (same format as super::history::MigrationStore::save_snapshot).
save_registered_snapshot
Builds the registered snapshot and writes it to path.
validate_migration_id
Validates a migration id used as a directory name and history key.
write_snapshot
Writes a snapshot to an explicit path (pretty JSON).