extractor
extractor
Expected Schema Extractor
This module builds the expected schema from migration operations without touching the database. It serves as the bridge between migration code (Input 2) and the expected database state.
This expected schema is used in Comparison B: Reality Check (expected ↔ actual) to detect: - Schema drift - Manual database edits - Broken legacy assumptions
The extractor replays migration operations to construct what the database should look like based on the recorded migration history.
SCHEMA_OPS = (models.CreateModel, models.DeleteModel, fields.AddField, fields.RemoveField, fields.AlterField, models.AlterModelTable, models.AddIndex, models.RemoveIndex, models.AddConstraint, models.RemoveConstraint)
module-attribute
MigrationExtractor(migration_graph, applied_nodes)
Projects a schema state purely from migration operations, without touching the database.
graph = migration_graph
instance-attribute
applied_nodes = applied_nodes
instance-attribute
build_state()
Build the expected schema state from applied migrations.