Repository navigation
feat: a name the model takes twice is refused at the diff, every collision at once - #97
Merged
Merged
Conversation
…ision at once The planner collects the names the target model's objects take: each declared object's claims from its contributor, EF Core's own tables, indexes, keys, foreign keys, check constraints and sequences from the dialect. Two equal claims with at least one party of SchemaKit's are a SchemaDiagnostic.NameCollision (SK1001), and all of them arrive in one SchemaValidationException. PostgreSQL's table of namespaces is held against the server on 16 and 18. Closes #96 Co-Authored-By: Claude Fable 5.2 <[email protected]>
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #96
Problem
A contributor answers
Claimsfor each descriptor, and nothing asked. Two objects that take one name were found by the database at apply, in the middle of a migration: an exclusion constraint named like an index anywhere in its schema, like its table's primary key, or like another unnamed constraint over the same elements, which gets the same default name.Change
NameClaims): each declared object's claims from its contributor, and those of EF Core's own tables, indexes, keys, foreign keys, check constraints and sequences from the dialect.ISchemaDialect.Claims(SchemaModelObject, TableRef, Identifier)is the provider's rule for EF Core's objects. The kernel's default: a table and a sequence within their schema, an index within its table, a constraint within its table. PostgreSQL's: an index is a relation of the schema; a primary key and a unique constraint take a constraint name and a relation name.NameComparisonsays otherwise. Two objects that collide in two namespaces are one finding.SchemaValidationExceptionwhoseDiagnosticsareSchemaDiagnostic.NameCollision, idSK1001, with both parties and the namespace named. Both types are public and unmarked: a consumer catches and reads them. The exception derives fromInvalidOperationException, like every other refusal.Tests
Locally: 508 kernel tests, 126 PostgreSQL tests offline, 50 on a live server, on PostgreSQL 16.15 and 18.6.
NameClaimLiveTests): the same names added by hand to a database are refused with 42P07 or 42710, or taken, exactly where the check refuses or lets through.HasDifferencesrefused alike; two of EF Core's own objects not reported.Guards shown to fail. 26 defects seeded one at a time, each failing its test: the planner not asking, the source held to it, each kind of EF Core's objects left out, each comparison loosened, each row of both dialects' tables changed, either of the exclusion constraint's two claims removed, and the seed #84 left open (the constraint's name carrying its table's schema). One survived the first run and was right to: I had added the model's default schema to a table without one, and EF Core's relational model does that already. The code is removed.
Decisions in this PR that are not confirmed
SchemaDiagnosticholds text only (Name,Namespace,First,Second), not theDeclarationRefthe design sketches. It keeps the unmarked type free of the marked contract.SK1001is now a permanent id.SchemaModelObject, and not by walking the model itself.Not in this PR
Staying with #44: ids for the kernel's existing refusals, warnings through the diagnostics logger.
🤖 Generated with Claude Code