| name | add-migration |
| description | Use when the user runs /add-migration <MigrationName> to generate, verify, and apply an EF Core migration in Timinute after an entity or model change. |
| disable-model-invocation | true |
Add EF Core Migration
Generate, verify, and locally apply a migration for Timinute.Server. The argument is the migration name (PascalCase, e.g. AddTaskNotes). If no name was given, ask for one — never invent it.
Steps
-
Precondition — confirm the model change is in a server entity (Timinute/Server/Models/) and the solution builds: dotnet build Timinute.sln. Client models and Shared DTOs do not affect the EF model.
-
Generate — the script computes paths relative to scripts/, so run it from there:
cd scripts; .\AddMigration.ps1 -name <MigrationName>; cd ..
-
Verify the generated migration before applying:
- New
<timestamp>_<MigrationName>.cs + .Designer.cs under Timinute/Server/Data/Migrations/.
git diff on ApplicationDbContextModelSnapshot.cs must show ONLY the intended change. Unrelated diffs = model drift — stop and investigate, do not apply.
- Column nullability/length must match the entity's annotations.
- If the change touches a seeded table (
HasData in ): non-nullable columns without defaults break the SQLite test helper ( builds schema from the model + seed). Update the seed in the same commit.