name: migration description: Manage EF Core database migrations. Use when adding, listing, or removing migrations for the workflow engine.
Add a new migration
dotnet ef migrations add <MigrationName> \
--project src/WorkflowEngine.Data \
--startup-project tests/WorkflowEngine.TestApp
After generating, run dotnet csharpier format on the new migration files in src/WorkflowEngine.Data/Migrations/.
List existing migrations
dotnet ef migrations list \
--project src/WorkflowEngine.Data \
--startup-project tests/WorkflowEngine.TestApp
Remove the last migration (if not yet applied)
dotnet ef migrations remove \
--project src/WorkflowEngine.Data \
--startup-project tests/WorkflowEngine.TestApp
Important notes
- Migrations are applied automatically on application startup via
DbMigrationService— there is no need to rundotnet ef database updatemanually. - Migration files live in
src/WorkflowEngine.Data/Migrations/. - The DbContext is
EngineDbContextinWorkflowEngine.Data. - Always format generated migration files with CSharpier before committing.