
Migrations
- 1 installs
- 14.8k repo stars
- Updated August 4, 2026
- dotnet/efcore
Implementation-detail guide for EF Core's migrations internals, for contributors changing MigrationsSqlGenerator, model diffing, operations, or the Migrator.
About
A contributor-facing skill documenting the EF Core migrations pipeline, model snapshot format, and test locations. A developer uses it when modifying EF Core's migration scaffolding, SQL generation, or model-differ code.
- Maps the add-migration and apply-migration pipelines end to end
- Notes model snapshots use property-bag Dictionary types, not real CLR types
Migrations by the numbers
- 1 all-time installs (skills.sh)
- Ranked #121 of 153 .NET & C# skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/dotnet/efcore --skill migrationsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 14.8k |
| Last updated | August 4, 2026 |
| Repository | dotnet/efcore ↗ |
What it does
Implementation-detail guide for EF Core's migrations internals, for contributors changing MigrationsSqlGenerator, model diffing, operations, or the Migrator.
Files
Migrations
Pipeline
Add migration: MigrationsScaffolder.ScaffoldMigration() → MigrationsModelDiffer.GetDifferences() → list of MigrationOperation → CSharpMigrationsGenerator and CSharpSnapshotGenerator produce Up/Down/Snapshot code
Apply migration: Migrator.MigrateAsync() → reads __EFMigrationsHistory → per pending: MigrationsSqlGenerator.Generate(operations) → MigrationCommandExecutor executes
Model Snapshot
- Model snapshots use
typeof(Dictionary<string, object>)(property bag format), not the actual CLR type. When examining theClrTypein a snapshot, don't assume it matches the real entity type. SnapshotModelProcessor.Process()is used at design-time to fixup older model snapshots for backward compatibility.
Testing
Migration operation tests: test/EFCore.Relational.Tests/Migrations/. Functional tests: test/EFCore.{Provider}.FunctionalTests/Migrations/. Model differ tests: test/EFCore.Relational.Tests/Migrations/Internal/MigrationsModelDifferTest*.cs.