Migrations

SkillAI & models

Guides your agent through how EF Core database migrations work internally, like SQL generation and model diffing.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Migrations skill

About this capability

Implementation details for EF Core migrations. Use when changing MigrationsSqlGenerator, model diffing, migration operations, HistoryRepository, the Migrator or related classes.

What this skill tells your AI

The instructions your AI receives, as published by dotnet/efcore in .agents/skills/migrations/SKILL.md and read by ahel’s review.

Pipeline

Add migration: MigrationsScaffolder.ScaffoldMigration()MigrationsModelDiffer.GetDifferences() → list of MigrationOperationCSharpMigrationsGenerator 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 the ClrType in 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.

Signals

GitHub stars
15k
Forks
3k
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
migrations-dotnet
Source
github.com/dotnet/efcore