Entity Framework DB Migrations (”Migrations”) are a way to safely transform the schema of the backing database between versions of the code.
Migrations are built to use a table in the database,
__MigrationHistory, to keep track of migrations that have been applied to the database.
This table contains various useful metadata; in particular the column
Model holds a binary representation of the code model as generated by Entity Framework for the version of the code that corresponds to the migration.
When creating a migration it’s important to work in a consistent and repeatable process, and from well defined states, to avoid experiencing unexpected results or confusing changes.
This article shows a process for consistently creating, and managing, your Migrations.