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_historytracking table
Structs§
- Migration
- Represents a single migration with up/down SQL scripts.
- Migration
Engine - The migration engine — compares old and new model snapshots to generate migration SQL.
- Migration
History Entry - Represents a record in the migration history table.
Table name:
__ef_migrations_historyCorresponds to EFCore’s__EFMigrationsHistory. - Migration
Store - Reads and writes migration scripts on disk.
- Model
Snapshot - A snapshot of the entity model at a point in time.
Corresponds to EFCore’s
ModelSnapshot. - Snapshot
Check - A CHECK constraint in a model snapshot.
- Snapshot
Column - Serialized form of PropertyMeta for snapshot storage.
- Snapshot
Entity Type - Serialized form of EntityTypeMeta for snapshot storage.
- Snapshot
Foreign Key - A composite foreign key in a model snapshot.
- Snapshot
Index - A declared index in a model snapshot.
- Snapshot
Index Column - One key part of a snapshot index.
- Snapshot
Table Options - MySQL table options in a model snapshot.
Enums§
- Migration
Dialect - 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
ModelSnapshotfrom all inventory-registered entities and#[entity(T)]configurations forcontext_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).