Skip to content

feat: a 5.x snapshot with an exclusion constraint on a TPC type is read - #190

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
feat/189-legacy-tpc
Nov 25, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
feat/189-legacy-tpc

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #189

The second of three slices of #118, after #187.

Problem

The 5.x reader refused an exclusion constraint on the root of a TPC hierarchy: 5.x gave every table its copy, and a declaration here was resolved for one table. A project with such a constraint could not move off 5.x.

Change

  • The fixture has ScaffoldedTpc: what the published 5.6.0 scaffolded for two TPC hierarchies (Generator/Tpc.cs), a root with a table of its own with a constraint under a name and one under the default name, and an abstract root with a constraint under a name. Eight constraints in its migration. The two fixtures that were there came out of the script unchanged, and a second run changed no file.
  • 5.x's names for the copies are the ones the landing function gives (Landing function, slice 1: a declaration on a TPC type lands on every table of the hierarchy below it #187): ex_rental, ex_rental_boat_rentals, ex_rental_car_rentals; ex_permit_fishing_permits, ex_permit_parking_permits under the abstract root; EX_rentals_During, EX_boat_rentals_During, EX_car_rentals_During.
  • The reader reads a constraint on a TPC type with derived types when the snapshot's CustomIndex:RenderingVersion is 3 or more, and refuses it below that or without the annotation, with the message that says to update to 5.6, add a migration and apply it.
  • LegacyHandoverTests: the snapshot against the same model declared here is no operations, from the snapshot to the model and back, and against a model that declares nothing every copy is dropped under 5.x's name.
  • LegacyHandoverLiveTests: 5.x's migration applied as scaffolded leaves the eight constraints EnsureCreated() builds for the model declared here, on PostgreSQL 16 and 18, and a copy 5.x built refuses its table's overlapping rows.

Not measured: that 5.6 creates the copies for a project that scaffolded before 5.5.0. The refusal's message says so from 5.x's own documentation of DeclarationTables.

Tests

Offline: 757 (kernel), 198 (PostgreSQL package), 87 (second provider). Live: 4 and 75 on PostgreSQL 16 and on 18, 86 on SQL Server 2022. The consumer smoke test: 47 rows.

Five rules were changed in turn and a test failed for each:

Changed Fails
An older snapshot's constraint is read too A_constraint_on_the_root_of_a_TPC_hierarchy_is_read_from_the_version_that_made_copies
A TPC type's constraint is refused whatever the version that, and the two offline handover tests
A snapshot without the version is taken for the newest A_constraint_on_the_root_of_a_TPC_hierarchy_is_read_from_the_version_that_made_copies
No copy's name gets the table the live handover, both offline handover tests, and #187's two
A copy's name gets the declaring type's name behind it the same five

🤖 Generated with Claude Code

From 5.5.0 on, 5.x gave every table of a TPC hierarchy its copy of a
constraint declared on a type above it. A declaration lands on the same
tables under the same names since #187, so the reader no longer refuses
such a constraint. A snapshot from before 5.5.0 has the constraint in
the declaring type's table alone and stays refused, with the way off it.

The fixture gains ScaffoldedTpc: what the published 5.6.0 scaffolded for
a TPC root with a table and for an abstract one. Its snapshot diffs to
nothing against the model declared here, both ways, and its migration
leaves the catalog EnsureCreated() builds, on PostgreSQL 16 and 18.

Closes #189

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 25, 2026
@CaffeinatedCoder CaffeinatedCoder added enhancement New feature or request package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL area/constraints Exclusion constraints, row guards and other constraint-like objects area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring labels Nov 25, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit a3b8b79 into main Nov 25, 2026
11 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the feat/189-legacy-tpc branch November 25, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/constraints Exclusion constraints, row guards and other constraint-like objects area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring enhancement New feature or request package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Landing function, slice 2: a 5.x snapshot with an exclusion constraint on a TPC root is read

1 participant