Skip to content

9.18.0

Choose a tag to compare

@jeremydmiller jeremydmiller released this 19 Jul 01:19
· 459 commits to master since this release

EF Core migration generation (epic #371)

Weasel can now generate standard EF Core migration files from its own schema model — the reverse of the existing EF → Weasel mapping. Any IDatabase (Marten system tables, Wolverine envelope storage, Polecat event storage, EF-projection tables) can emit compilable, attribute-only migrations that teams apply with dotnet ef database update, idempotent scripts, or bundles. See the new Migration Generation and Mixed EF + Critter Stack Apps docs.

  • Translation layer (#375): Weasel schema objects → EF MigrationOperation lists with raw store types throughout; identity/computed/index/FK provider mapping; raw-SQL fallback for everything EF can't model (partitioned tables, functions, sprocs)
  • C# emitter + stub DbContext (#381): attribute-only migration files with real Up()/Down() bodies (no BuildTargetModel — verified first-class by the #364 spike on EF 9 + EF 10); stub context with the __EFMigrationsHistory table relocated into the critter-stack schema and a design-time factory for the EF CLI
  • Incremental migrations (#377): a serialized JSON schema snapshot (Weasel's design-time analog of EF's ModelSnapshot) with an in-memory differ — no live database needed — plus a live-database baseline mode that wraps Weasel's own migration SQL in Sql() operations
  • db-ef-migration CLI (#378): add <Name> (first-run scaffold + incremental adds), script (canonical EF-toolchain guidance), and baseline (adopt a pre-existing database by recording history rows without executing)
  • Inverted validation harness (#379): generated migrations are Roslyn-compiled and applied through the real EF runtime in CI, then must match a Weasel-created schema catalog-for-catalog with a zero Weasel delta
  • Documentation (#380)

Computed / generated columns (#373, closes #363)

PostgreSQL GENERATED ALWAYS AS (...) STORED and SQL Server AS (...) [PERSISTED] columns now round-trip fully: fluent GeneratedAs/ComputedAs builders, catalog introspection in FetchExisting, and delta detection with canonicalized expression comparison. Changed definitions migrate via lossless drop + re-add; computed columns unknown to the model are left alone.

ManagedTenantPartitions parity with ManagedListPartitions (#374, closes #362)

SQL Server managed tenant partitioning closes its gaps against the PostgreSQL feature set ahead of the Wolverine conjoined-tenancy epic:

  • TenantDropBehavior.DeleteData — physically remove a tenant's rows before MERGE RANGE (hard-delete parity)
  • Tenant bucketing: AllowOrdinalSharing + explicit-ordinal registration so many tenants can share one partition (the 15,000-partition-ceiling mitigation); shared ordinals are only merged/purged when their last tenant leaves
  • MigrateAllTablesAsync back-fill for tables joining an existing managed set
  • Batch adds return per-table TablePartitionStatus[] with per-table failure isolation

Also in this release (staged as 9.17.0, previously unreleased)

  • EF Core mapping sweep (#361): dual-schema comparison harness + fixes for casing, indexes, defaults, identity, delete behaviors, and SQL Server includes; new ci-build-efcore.yml
  • EF Core follow-up round (#372): sequences (HiLo), check constraints, computed-column emission, index methods (HasMethod("gin")), opt-in column drift detection, Oracle casing parity, MySQL EF CI

Full Changelog: 9.16.4...9.18.0