EF Core — workflow de migrationsEF Core — migration workflow
Le skill /efcore couvre le cycle de vie complet des migrations Entity Framework Core sur un projet généré SmartStack (dual context : CoreDbContext + ExtensionsDbContext) ou sur le Studio (single context, providers Sqlite / Postgres / SqlServer).
The /efcore skill covers the full Entity Framework Core migration lifecycle on a generated SmartStack project (dual context: CoreDbContext + ExtensionsDbContext) or on the Studio (single context, Sqlite / Postgres / SqlServer providers).
Routing des opérationsOperation routing
| IntentionIntent | Agent | CLI |
|---|---|---|
| Lister les migrationsList migrations | agents/list.md |
cli/list |
| État (pending / applied)Status (pending / applied) | agents/status.md |
cli/status |
| Créer une migrationCreate a migration | agents/create.md |
cli/create |
| Compresser avant mergeSquash before merge | agents/squash.md |
cli/squash |
| Rebase snapshotRebase snapshot | agents/rebase-snapshot.md |
cli/rebase-snapshot |
| Appliquer (dotnet ef database update)Apply (dotnet ef database update) | agents/db-update.md |
cli/apply |
| Recréer la base de zéroRecreate the database from scratch | agents/recreate-db.md |
— |
Convention de nommageNaming convention
Toutes les migrations suivent le pattern {prefix}v{version}{seq3}{Description}, calculé par cli/lib/migration-name.ts :
All migrations follow the pattern {prefix}v{version}{seq3}{Description}, computed by cli/lib/migration-name.ts:
Core_v5_0_0_001_AddInitialSchema
Ext_v5_0_0_002_AddInvoiceTable
| TokenToken | SourceSource |
|---|---|
prefix |
Core / Ext / Sqlite / Postgres / SqlServer |
version |
version du projet — package.json (source de vérité GitFlow), sinon .csprojproject version — package.json (GitFlow source of truth), else .csproj |
seq3 |
numérotation séquentielle à 3 chiffres3-digit sequential numbering |
Description |
PascalCasePascalCase |
Détection automatiqueAutomatic detection
Le CLI détecte automatiquement la structure : The CLI auto-detects the structure:
- App générée : 2 contextes, 2 fichiers de migrations.Generated app: 2 contexts, 2 migration files.
- Studio : 1 contexte, 3 projets de migrations (un par provider).Studio: 1 context, 3 migration projects (one per provider).
Plus aucune dépendance MCP — cli/lib/ef-runner.ts appelle dotnet ef directement.
No more MCP dependency — cli/lib/ef-runner.ts calls dotnet ef directly.
Dans quel cas ?Which situation, which command?
| Je suis dans ce cas…I am in this situation… | …alors je fais…then I do |
|---|---|
| J'ai ajouté/modifié une entité et je veux la refléter en baseI added/changed an entity and want it reflected in the database | /efcore create — le nom est calculé automatiquement selon la convention/efcore create — the name is computed automatically per the convention |
| Ma base locale est en retard sur les migrations du codeMy local database is behind the code's migrations | /efcore apply — appliqué seulement si la base est prouvée locale (loopback, hostname machine)/efcore apply — applied only when the database is proven local (loopback, machine hostname) |
| Ma feature a accumulé 12 migrations avant le mergeMy feature piled up 12 migrations before the merge | /efcore squash — consolide UNIQUEMENT les migrations propres à la branche, jamais une migration déjà présente dans la branche cible/efcore squash — consolidates ONLY the branch's own migrations, never one already present in the target branch |
| Je ne sais plus ce qui est appliqué ou en attenteI no longer know what is applied or pending | /efcore status |
| Le snapshot EF est en conflit après un mergeThe EF snapshot conflicts after a merge | /efcore rebase-snapshot |
| Ma base de dev est irrécupérable, je repars de zéroMy dev database is beyond repair, I start over | /efcore recreate-db (destructif — demande confirmation)/efcore recreate-db (destructive — asks for confirmation) |
⚠️ N'appelez jamais dotnet ef directement dans le shell : le hook ef-guard le bloque. Le chemin sanctionné est /efcore, qui applique la politique de risque (une migration destructive exige une confirmation explicite).
⚠️ Never call dotnet ef directly in the shell: the ef-guard hook blocks it. The sanctioned path is /efcore, which enforces the risk policy (a destructive migration requires explicit confirmation).
Skills disponibles
Available Skills
infrastructure
/efcore
infrastructure
EF Core migration workflow — create, squash, rebase-snapshot, apply, list, status. Applies the best practices of the global /efcore agents without MCP or external dependencies. Works against a single-assembly generated app (CoreDbContext + ExtensionsDbContext) or the multi-assembly Studio (StudioDbContext with Sqlite / Postgres / SqlServer migration projects).
[create|squash|rebase-snapshot|apply|list|status|recreate-db] [-BruteForce]