You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First-class EF Core migration artifact generation from Weasel schema objects: translate everything an IDatabase knows about (tables, columns, indexes, FKs, sequences, functions, partitions) into compilable EF Core migration classes/files, so that Marten, Polecat, and Wolverine users can ship schema changes through the standard EF toolchain — dotnet ef database update, idempotent scripts, migration bundles, __EFMigrationsHistory.
This is the reverse of the existing Weasel.EntityFrameworkCore direction (MapToTable: EF DbContext → Weasel tables, where Weasel applies the migration). Here Weasel authors the migrations and EF applies them.
Why
Teams mixing EF Core with Marten/Polecat/Wolverine in one application get a single artifact format and deployment pipeline for all schema changes.
DBA/CI-review workflows built around EF migrations (scripts, bundles) work for critter-stack schema objects.
Prior art gap: nothing in the ecosystem generates EF migration files from an external schema definition. Bloomberg's Sable (archived July 2026) is the closest workflow precedent, but it emitted plain SQL and its diff engine was Marten's own marten-patch — i.e., Weasel already owns the hard part.
Coexistence via multi-context EF: one Weasel-owned stub DbContext per IDatabase, history table relocated into the critter-stack schema, so generated migrations never collide with the user's own app-context migrations. Supports any mix of EF Core + Marten + Polecat + Wolverine.
Raw-SQL fallback (migrationBuilder.Sql()) for everything EF can't model: PG partitioning, PL/pgSQL functions, SQL Server procedures/table types, sequence default expressions, rich index options.
Snapshot baseline without a shadow database: serialized Weasel schema snapshot (JSON) diffed in memory via TableDelta — improves on Sable's Testcontainers-replay approach.
IDatabase is the single source of schema objects, same as the existing db-* commands.
Marten / Polecat / Wolverine consumption docs and any thin registration helpers — no engine changes expected there, since everything flows through IDatabase.
Goal
First-class EF Core migration artifact generation from Weasel schema objects: translate everything an
IDatabaseknows about (tables, columns, indexes, FKs, sequences, functions, partitions) into compilable EF Core migration classes/files, so that Marten, Polecat, and Wolverine users can ship schema changes through the standard EF toolchain —dotnet ef database update, idempotent scripts, migration bundles,__EFMigrationsHistory.This is the reverse of the existing
Weasel.EntityFrameworkCoredirection (MapToTable: EF DbContext → Weasel tables, where Weasel applies the migration). Here Weasel authors the migrations and EF applies them.Why
marten-patch— i.e., Weasel already owns the hard part.Architecture (decided)
MigrationBuildercalls +[DbContext]/[Migration]attributes. No EF design-time scaffolding APIs (pubternal; Scaffolding Migrations programmatically in Asp.Net Core 5 and EF Core 5 dotnet/efcore#23595 closed as not-planned).BuildTargetModel— runtime-valid; verified by spike (Spike: attribute-only EF Core migrations without a real EF model #364). EF 9+ requires suppressingRelationalEventId.PendingModelChangesWarningin the generated stub context.DbContextperIDatabase, history table relocated into the critter-stack schema, so generated migrations never collide with the user's own app-context migrations. Supports any mix of EF Core + Marten + Polecat + Wolverine.MapToTable→IDatabase.AllObjects()→ generated artifacts.migrationBuilder.Sql()) for everything EF can't model: PG partitioning, PL/pgSQL functions, SQL Server procedures/table types, sequence default expressions, rich index options.TableDelta— improves on Sable's Testcontainers-replay approach.IDatabaseis the single source of schema objects, same as the existingdb-*commands.Phases
db-ef-migration add | script | baselineRough ordering: #363 and #364 can run in parallel and first; #365 → #366 → #367 → #368 build on each other; #369 grows alongside #365–#368; #370 lands last.
Out of scope (tracked downstream)
IDatabase.dotnet ef migrations add/removeagainst the Weasel stub context is explicitly unsupported (documented in EF migration generation: documentation #370).