name: create-migration description: Scaffolds a new EF Core migration for oed-authz, reviews it for safety, and optionally applies it to the local dev database. disable-model-invocation: true
Follow these steps to create a new EF Core migration:
Get migration name: If the user provided a name as an argument, use it. Otherwise ask: "What should the migration be named? (PascalCase, e.g. Add_column_foo)"
Scaffold the migration:
dotnet ef migrations add {name} --project src/oed-authzIf this fails (e.g. model snapshot conflict), show the error and stop.
Locate the generated files: The new migration will appear in
src/oed-authz/Infrastructure/Database/Migrations/as{timestamp}_{name}.csand{timestamp}_{name}.Designer.cs, plus an updatedOedAuthzDbContextModelSnapshot.cs.Review with migration-reviewer: Read the generated
{timestamp}_{name}.csfile and pass it to themigration-reviewersubagent. Show the verdict to the user.If UNSAFE: Tell the user what to fix and stop. Do not apply the migration.
If SAFE or REVIEW-NEEDED: Ask the user: "Apply migration to local dev database? (requires local PostgreSQL running with admin credentials)"
- If yes:
dotnet ef database update --project src/oed-authz - Show success or error output.
- If yes:
Remind the user: The
OedAuthzDbContextModelSnapshot.csmust be committed alongside the migration files.