migration-workflow
Installation
SKILL.md
Migration Workflow
Core Principles
- Verify before applying — Always review generated migration SQL before applying to any database.
dotnet ef migrations scriptshows the exact SQL. Never apply blindly. - Rollback plan always — Every migration has a rollback. For EF Core:
dotnet ef database update <PreviousMigration>. For packages: git revert. For .NET version: branch-based rollback. Document the rollback before applying. - Test after migration — Run the full test suite after every migration step. Migrations that break tests are not complete. Integration tests with Testcontainers catch real database issues.
- One change per migration — Each EF Core migration should represent a single logical change (add table, rename column, add index). Multiple unrelated changes in one migration make rollback impossible.
- Incremental updates — Update one package at a time, build, test. Update one target framework at a time, build, test. Never batch unrelated changes — when something breaks, you need to know which change caused it.
Patterns
EF Core Migration Workflow
Step-by-step workflow for creating and applying database migrations safely.