Add migration
Skill makigjuro/cloudstack-ai-plugins/plugins/dotnet-architect/skills/add-migration
Create an EF Core migration for a specific microservice. Use after adding or modifying entities, DbSets, or entity configurations -- migration creation is mandatory for any schema change.From its SKILL.md
npx -y skills add makigjuro/cloudstack-ai-plugins --skill add-migrationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 8 commands, including `grep -rn "class.*DbContext" src/{Service}/**/Infrastructure/ --include="*.cs"` and 7 more.
SKILL.md
3.2 KB, 693 tokens by cl100k_base, as published. Nobody here has run it
Add EF Core Migration
Create a new EF Core migration for a microservice's database context.
Arguments
{Name}-- Migration name in PascalCase (e.g.,AddOrdersTable){Service}-- Target microservice (ask if ambiguous)
Configuration
Read cloudstack.json from the project root at the start of execution. Extract:
SERVICES=backend.services[](default: discover fromsrc/*/directories containing.Application/subfolders)SOLUTION=backend.solutionPath(default: find*.slninsrc/)
If cloudstack.json does not exist, auto-detect by scanning the project structure.
Service DbContext Discovery
If a service-to-DbContext mapping is not defined in cloudstack.json, auto-detect by searching for *DbContext.cs files:
grep -rn "class.*DbContext" src/{Service}/**/Infrastructure/ --include="*.cs"
Find the Infrastructure and Host projects:
find src/{Service} -name "*.Infrastructure.csproj" -o -name "*.Host.csproj"
Process
Step 1: Verify Changes
Before creating a migration, check that entity configurations are in place:
# Find the entity configuration
grep -rn "IEntityTypeConfiguration" src/{Service}/
Step 2: Create Migration
Run from the Infrastructure project directory:
dotnet ef migrations add {Name} \
--project src/{Service}/{Service}.Infrastructure \
--startup-project src/{Service}/{Service}.Host \
--output-dir Persistence/Migrations
If the startup project differs from the convention, search for the .Host project:
find src/{Service} -name "*.Host.csproj" -o -name "*.Host" -type d
Step 3: Review Migration
Read the generated migration file and verify:
- Only expected changes are included
- No data loss operations (dropping columns/tables) without user confirmation
- Index names follow conventions
- Foreign keys are correct
# Find the latest migration
ls -t src/{Service}/**/Migrations/*.cs | head -2
Step 4: Apply Migration (Optional)
Only apply if the user explicitly asks:
dotnet ef database update \
--project src/{Service}/{Service}.Infrastructure \
--startup-project src/{Service}/{Service}.Host
After Creating
- Report the migration file path
- Show a summary of schema changes (tables created/altered, columns added/removed)
- Warn about any potentially destructive changes
Error Handling
- EF Core tools not installed: Run
dotnet tool install --global dotnet-efand retry. - No pending model changes: The migration will be empty -- warn the user and skip creation.
- Startup project can't build: Run
dotnet buildon the Host project first to surface errors. - Migration includes unexpected changes: Warn about potential schema drift. Suggest verifying entity configurations match the intended changes.
Related Skills
/add-entityto create the entity and EF Core configuration first/run-teststo verify tests still pass after migration
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.