← ClaudeAtlas

diagnose-migration-history-divergencelisted

Diagnose EF Core migration-history divergence between a target environment's __EFMigrationsHistory table and a deploying or rolling-back branch's Migrations folder — trace each divergent migration to its origin branch/author/merge-status via git, classify its risk, and produce a hand-off report. Triggers on "migration history divergence", "migration was not found" deploy failures, "EF Core migration mismatch between environments", and "pending model changes" / rollback-planning questions before running Update-Database against a shared environment.
justinmchoi/ai-toolkit · ★ 1 · API & Backend · score 80
Install: claude install-skill justinmchoi/ai-toolkit
# Diagnose Migration-History Divergence Use when an EF Core deploy or rollback against a **shared** environment (not a personal dev DB) surfaces a `migration '<id>' was not found` error, or before running `Update-Database` / `dotnet ef database update` against a shared environment as a rollback. Either situation means the target's `__EFMigrationsHistory` may contain migrations the current branch doesn't know about. ## Why this is skill-shaped, not a one-off fix Any team running EF Core migrations against a shared environment from multiple parallel branches can hit "the environment has migrations the current branch doesn't know about" — typically because someone applied an unmerged branch's migrations directly to that environment, whether as a deliberate shortcut or by accident. The failure mode shows up from two different entry points that look unrelated at first: - A **deploy pipeline** fails applying a new migration with a "migration ... was not found" error that's confusing on its face, since the named migration usually isn't the one actually being deployed. - A **planned rollback** (`Update-Database <id>` or equivalent) silently targets the wrong point in history, or fails outright, because the branch doing the rollback also doesn't contain the divergent migrations sitting in the environment's history table. Same root cause, same multi-step manual git trace, done by hand each time regardless of which entry point surfaced it. The diagnostic sequence generali