v5.1.0
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:
HasDifferencesnow reports changes to complex indexes, exclusion constraints and temporal constraints. EF Core's base implementation runs its ownDiffrather than theGetDifferencesthis 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 warningMigrate()raises since EF Core 9, and the snapshot check inmigrations remove. A CI gate built onhas-pending-model-changesmay now fail where it previously passed — that is the gate working. - Fixed: a complex index whose name matches a native
HasIndexon the same table is now rejected atdotnet ef migrations add. The base differ emitted one and this package the other, neither seeing the other, so the migration scaffolded twoCREATE INDEXstatements 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 checkMigrate()performs run the context's runtime differ, which the design-time wiring never reaches — soEnsureCreated()created the tables and silently none of the complex indexes, andMigrate()never warned about one that was not scaffolded.UseNpgsqlComplexIndexes()now registers the PostgreSQL differ alongside the generator; SQL Server getsUseSqlServerComplexIndexes(); providers without a satellite getUseComplexIndexes()from the core package. Each has anAdd…ComplexIndexescounterpart for a custom internal service provider. With a satellite installed, call the satellite's method only. - New: whole-document JSON indexes on PostgreSQL. Pointing
HasComplexIndexat aToJson()complex property — or at a complex collection, which is always JSON — now indexes itsjsonbcontainer column, soHasComplexIndex(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
HasComplexIndexoverloads also exist on the non-genericComplexTypePropertyBuilder, 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 addinstead 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.