Repository navigation
The factory starts an exclusion constraint's elements with an operator of one's own - #278
Merged
Merged
Conversation
…perator of one's own PgSchema<TEntity>.WithUncheckedOperator(key, operator) returns ExclusionElements<TEntity> and goes through Exclusions.Unchecked, so "=" is refused as the chained form refuses it. A constraint over another library's range alone, or with that range first, has a lambda form. The declaration is the one the records make: one key and one value. Refs #257 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… starts the elements The paragraph on ValueRanges no longer sends the range alone to records, the row of what is not there yet is gone, and the guide's two rows name the form for the first element. A 5.x snapshot with the range alone or first is held against the starting form. Refs #257 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…an assertion that cannot fail Refs #257 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Owner
Author
|
Reviewed at 873c47d by the coordinating session.
Nothing to change. |
9 tasks done
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 #257
Problem
The elements of an exclusion constraint could begin only with
pg.Equal(…)or withpg.Overlaps(…), andpg.Overlapstakes Npgsql's own ranges alone.WithUncheckedOperatorwas on what those two return and not on the factory. So a constraint over another library's range alone, or with that range first, had no lambda form, and was written as records with the property by its name:A package outside this repository could offer a typed
Overlapsafter another element and none that starts the elements.Change
As decided on 2026-11-29 in the issue:
PgSchema<TEntity>.WithUncheckedOperator<TValue>(key, operator), with the chained form's parameters, returnsExclusionElements<TEntity>. It goes throughExclusions.Unchecked, so=is refused with the chained form's message. Public, with noSK9001.ExclusionElements<TEntity>.Equalwas there.ExclusionElements<TEntity>andExclusionDraft<TEntity>still have no public constructor.Both of these compile and reach the database:
Pages: the README's section on ValueRanges (the bullet that sent the range alone to records, and the row under what the preview does not do), the PostgreSQL package's README (one sentence), the guide's two rows for
WithColumnandWithOverlaps,design/schemakit-api.md(P2, the table of what the compiler cannot see, 10.2, one row of section 13), the changelog under### Added, andCLAUDE.md.In section 13 of the design the row for
WithExpression(sql, "=")said.WithUncheckedOperator(x => Sql.Raw<T>("…"), "="), which throws. It now says.Equal(x => Sql.Raw<T>("…")), as the guide does.Tests
In the PostgreSQL package's tests:
PgExclusionDeclarationTests: the starting form makes the records' declaration, and the typed form's;=is refused with the chained form's message; a model written with the factory stores the keys and values of the same model written as records, and the two diff to nothing both ways.PgExclusionProbeTests(new): the design's P2 and each starting form compiled against the shipped assembly with nothing suppressed, beside the draft of equality elements that must not compile (CS1503), the typedOverlapsover another type (CS0411), and a call without an operator (CS7036).ConsumerCompileTests: the consumer's model has both starting forms.In the cross-tests with ValueRanges:
SatelliteSurfaceTests:Nothing_public_starts_the_elements_with_an_operator_of_ones_ownbecameThe_factory_starts_the_elements_with_an_operator_of_ones_own_and_hands_out_no_other_way.TypedOverlapshas the startingOverlaps, an extension ofPgSchema<TEntity>, andA_typed_Overlaps_that_starts_the_elements_is_the_declaration_written_as_recordsholds it to the records.Bookings.DuringAloneAsRecordskeeps the records' form, andWritten_with_the_factory_a_constraint_is_the_declaration_a_snapshot_holds_from_the_recordsholds one key and one value, in the model and in the scaffolded snapshot, and no operations against the other form's compiled snapshot, both ways. Its second pair has the range first and no name.Bookings.DuringFirstis new, with its statement, its snapshot, its twin over Npgsql's range, a 5.x snapshot in 5.x's form (ComingFrom5xTests), and a live test.Each guard without its subject, in a copy of the commit outside the checkout:
=Started_with_equality_the_unchecked_operator_is_refused_as_the_chained_form_refuses_itand the cross-tests'Started_with_equality_the_unchecked_operator_is_refused: "Expected exception of exact type ArgumentException but no exception was thrown"SK9001ExclusionElements<TEntity>has a public constructorThe_factory_starts_the_elements_with_an_operator_of_ones_own_and_hands_out_no_other_wayfailsThe tests that compile against the method are tests of the feature: without the method they do not build, which is said here and not counted as a guard.
Run locally:
dotnet build CodoMetis.EFCore.SchemaKit.slnxwith no warning; offline, the kernel's tests (911), the PostgreSQL package's (498) and the cross-tests (33). On PostgreSQL 16 and 18, in two throwaway containers that are removed again: the cross-tests' live tests (13 each, withA_constraint_over_the_range_alone_applies_on_a_database_without_any_extensionand the newA_constraint_with_the_range_first_is_migrated_to_what_EnsureCreated_builds_and_refuses_an_overlap) andPgExclusionLiveTests(60 each). Not run locally: the rest of the PostgreSQL package's live tests, the SQL Server lane, the spikes and the consumer smoke test, none of which this change touches.🤖 Generated with Claude Code