"Entity Framework Core 8 code-first workflow on the Griot backend: entity mapping, migrations, SQL Server application. Use whenever schema or data-layer work changes."
Install
npx skillscat add donartkins/griot/dotnet-ef-core Install via the SkillsCat registry.
SKILL.md
EF Core 8 Skill
Per-repo setup (research/gtp-2026-prep.md §6.5)
cd backend
dotnet new globaljson --sdk-version 8.0.1xx --roll-forward latestFeature
dotnet new tool-manifest && dotnet tool install dotnet-efMapping rules
- Entities live in
Griot.Domain;GriotDbContext(inGriot.Infrastructure) maps them inOnModelCreating. - Enums stored as
varcharviaHasConversion<string>()so SQL reads are readable. Guidkeys;CreatedAt/UpdatedAtset via aSaveChangesAsyncoverride usingSYSUTCDATETIME().- Index every FK; composite indexes per the approved ERD (e.g.
TaskItems(ColumnId, Position)).
Migration workflow
dotnet ef migrations add <Name> --project src/Griot.Infrastructure --startup-project src/Griot.Api
# review the generated SQL, then:
dotnet ef database update --project src/Griot.Infrastructure --startup-project src/Griot.ApiMigrations commit to src/Griot.Infrastructure/Migrations/. Production migrations run as the Railway release command, never assumed local.
Verify
dotnet buildclean;SELECT name FROM sys.tablesmatches the ERD; indexes match the ERD annotations.- Renames propagate (contract sync): ERD → DbContext → GraphQL types → web/mobile type files → MCP schemas.