Skip to content

v5.1.0

Choose a tag to compare

@github-actions github-actions released this 05 Sep 06:46
· 11 commits to main since this release
2110a80

5.1.0

Small enhancements around the two seams, plus the silent failures found while planning the next
major: a pending-changes check that never saw this package, and two ways a declaration could vanish
from a migration without a word.

  • Fixed: HasDifferences now reports changes to complex indexes, exclusion constraints and temporal constraints. EF Core's base implementation runs its own Diff rather than the GetDifferences this package overrides, so every check built on it reported "no changes" when only a declaration from this package had changed: dotnet ef migrations has-pending-model-changes, the pending-model-changes warning Migrate() raises since EF Core 9, and the snapshot check in migrations remove. A CI gate built on has-pending-model-changes may now fail where it previously passed — that is the gate working.
  • Fixed: a complex index whose name matches a native HasIndex on the same table is now rejected at dotnet ef migrations add. The base differ emitted one and this package the other, neither seeing the other, so the migration scaffolded two CREATE INDEX statements under one name and failed when applied (42P07). Only the target model's native indexes are consulted, so an index moving between a native declaration and a complex one under the same name still diffs as before.
  • Fixed: a provider option from the other satellite on a property-level complex index is now rejected at migrations add, like an entity-level one, instead of being dropped by the forwarding whitelist without a word — .UseGin() on a property-level index diffed by the SQL Server satellite scaffolded a plain B-tree. The PostgreSQL differ likewise rejects SQL Server options, which it previously passed through to a generator that ignored them.
  • New: runtime registration of the differ. Database.EnsureCreated(), GenerateCreateScript() and the pending-model-changes check Migrate() performs run the context's runtime differ, which the design-time wiring never reaches — so EnsureCreated() created the tables and silently none of the complex indexes, and Migrate() never warned about one that was not scaffolded. UseNpgsqlComplexIndexes() now registers the PostgreSQL differ alongside the generator; SQL Server gets UseSqlServerComplexIndexes(); providers without a satellite get UseComplexIndexes() from the core package. Each has an Add…ComplexIndexes counterpart for a custom internal service provider. With a satellite installed, call the satellite's method only.
  • New: whole-document JSON indexes on PostgreSQL. Pointing HasComplexIndex at a ToJson() complex property — or at a complex collection, which is always JSON — now indexes its jsonb container column, so HasComplexIndex(x => x.Payload, ix => ix.UseGin().HasOperators("jsonb_path_ops")) produces the idiomatic GIN index. Previously the path failed with "could not resolve property path", and complex collections could not be indexed at all. The container is a real column, so no runtime wiring is involved; a complex property nested inside the document resolves to a -> extraction and renders like any expression index.
  • New: HasStorageParameter(name, value) on PostgreSQL complex and expression indexes — WITH (fillfactor=70), WITH (fastupdate=false), and so on. Column indexes render through Npgsql's own generator; expression indexes through this package's, in the same clause position.
  • New: UseCollation(params string[]) on PostgreSQL complex and expression indexes — per-column index collations ("Name" COLLATE "C"), positional, with an empty entry leaving that column on its default. Independent of the column's own collation, which is never copied onto the index.
  • New: the property-level HasComplexIndex overloads also exist on the non-generic ComplexTypePropertyBuilder, so a property configured by name (c.Property("Value")) or by type can carry a complex index.
  • Changed: a complex index, exclusion constraint or temporal constraint declared on an entity type that is mapped to no table — typically the abstract base of a TPC hierarchy — now fails at migrations add instead of producing nothing without a word. Declarations on view-mapped and query-mapped types are still ignored.

Published to nuget.org through Trusted Publishing by this run. The CycloneDX SBOM for each package is attached below.