migration

Creates and applies EF Core database migrations for .NET microservices with rollback testing.

1|Updated Apr 27, 2026
One-click install
npx skills add https://github.com/GSU26SE55/backend --skill migration-gsu26se55
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: migration
Source: https://github.com/GSU26SE55/backend/tree/main/.codex/skills/be/migration
Command: npx skills add https://github.com/GSU26SE55/backend --skill migration-gsu26se55

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Schema changes in a multi-service .NET backend are risky: a badly written migration can drop production data, break NOT NULL constraints on existing rows, or fail to roll back. This Skill enforces a disciplined EF Core migration workflow so every schema change is named clearly, seeded safely, and rollback-tested before commit. ## Core Features & Use Cases - Standardized migration commands: Create and apply migrations with the correct -p (Infrastructure project) and -s (startup project) flags for each microservice. - Safe NOT NULL handling: Seed existing rows with migrationBuilder.Sql before adding constraints, and always provide defaultValue. - Mandatory rollback test: Revert to the previous migration and re-apply to prove Down() works before committing. - Use Case: You add a status column to the batteries table. The Skill guides you to name the migration AddBatteryStatusColumn, seed existing rows, set a default value, and verify rollback — instead of shipping a migration that fails on production data. ## Quick Start Ask the AI to create and apply an EF Core migration for your entity change, following the migration checklist including the rollback test.

Frequently Asked Questions about migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an EF Core migration in a multi-project .NET solution?▼

Run dotnet ef migrations add {MigrationName} -p ../ServiceName.Infrastructure -s . from the API project directory. The -p flag points to the Infrastructure project holding the DbContext, and -s sets the startup project.

How to add a NOT NULL column to an existing table with EF Core?▼

Seed existing rows first with migrationBuilder.Sql, for example UPDATE batteries SET status = 1 WHERE status IS NULL, then alter the column with nullable: false and a defaultValue. Adding the constraint without seeding fails on tables that already contain data.

How do I test EF Core migration rollback?▼

Run dotnet ef database update {PreviousMigrationName} to roll back, then dotnet ef database update to re-apply. This proves the Down() method works before the migration is committed.

When should I use TimescaleDB vs PostgreSQL for a table?▼

Use TimescaleDB hypertables for time-series data such as sensor readings. Use standard PostgreSQL for relational data like users, tickets, configurations, and battery configs.

Why should renames use RenameColumn instead of drop and recreate?▼

RenameColumn preserves existing data in the column, while dropping and recreating a column deletes all stored values. The migration checklist explicitly forbids DROP TABLE and TRUNCATE in Up() or Down() methods.