| name | ef-migration |
| description | Create or modify an Entity Framework Core migration for PlaylistMiner database schema changes. |
EF Core Migration
Create a new migration after modifying entities or DbContext.
Steps
-
Verify changes — check what entities or relationships changed:
git diff src/PlaylistMiner.Core/Models/
git diff src/PlaylistMiner.Infrastructure/Data/
-
Create migration with a descriptive name:
dotnet ef migrations add <DescriptiveName> \
--project src/PlaylistMiner.Infrastructure \
--startup-project src/PlaylistMiner.Api
-
Review the generated migration in src/PlaylistMiner.Infrastructure/Migrations/
- Check for data loss (column drops, type changes)
- Verify index creation (especially pg_trgm GIN indexes)
- Ensure seed data is correct
-
Apply migration locally:
dotnet ef database update \
--project src/PlaylistMiner.Infrastructure \
--startup-project src/PlaylistMiner.Api
-
Test — run integration tests to verify schema works:
dotnet test tests/PlaylistMiner.IntegrationTests
Naming Conventions
AddVideoTable, AddTagRules, CreateSearchIndexes
AlterVideoAddStatus, DropLegacyColumns
- Never:
Migration1, Update, Fix
Rollback
dotnet ef migrations remove
dotnet ef database update <PreviousMigrationName>