Repository navigation
feat: the SQL vocabulary, statements with no hole for a string - #42
Merged
Merged
Conversation
The first part of the contributor contract (#23), public and marked experimental (SK9001) until the contract freezes at rc.1. - Identifier, TableRef, QualifiedName, SqlName, SqlOperator and SqlFragment have no public constructor taking text and convert from none: an identifier comes from the dialect, which checks its length, an operator from the dialect's grammar. - SchemaSql builds a statement from an interpolated string whose holes take only those values, int and long. It appends the provider's statement terminator and refuses a statement that brings one, an empty one, and a DROP … IF EXISTS. - SchemaDialect delimits and terminates through the provider's ISqlGenerationHelper and writes literals through its type mapping; SchemaScope is a closed Table | Schema | Database. - A schema-scoped object is dropped by table.Qualify(name). On a live PostgreSQL the unqualified form removes another schema's index, which is now a test. - The host resolves its planner and rewriters on first use: the ownership check resolves the differ while a model is built, and the dialect reads the design-time model. Injected, the planner cycles (121 tests fail that way). 162 kernel tests on Npgsql, SQL Server and SQLite, two of them on a live PostgreSQL 18 behind a new integration lane; 25 compile-probe tests against the shipping assembly beside the prototype's 72. Fourteen mutations each failed their tests or probes. Built locally on SDK 11.0.100-rc.1 in a scratch copy. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This was referenced Nov 11, 2026
Closed
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 #23
Problem
Every schema object SchemaKit will create is rendered at design time into a
SqlOperation, text that EF Core runs as it is. In 5.x that text was built by string concatenation with a hand-rolledQuote, and the prototype of this design dropped an index by an unqualified name. The contract needs a way to write DDL in which an unquoted name is not a mistake a reviewer has to catch, and spike B added a second rule: a statement without the provider's terminator passes every path except the generated scripts.Change
src/CodoMetis.EFCore.SchemaKit/Sql, the first part of the contributor contract. Public, and marked[Experimental("SK9001")]until the contract freezes at rc.1.Identifier,TableRef,QualifiedName,SqlName,SqlOperator,SqlFragment. None has a public constructor taking text, and none converts fromstring.SchemaSql:sql.Statement($"CREATE INDEX {name} ON {table} ({column})"). A hole takes only those values,intandlong. It appends the provider's statement terminator, and refuses a statement that brings one, an empty one, and aDROP … IF EXISTS.ISchemaDialectandSchemaDialect: the only place that turns text into those values. Length is checked against the model'sMaxIdentifierLength, operators against the operator grammar; delimiting and the terminator are the provider'sISqlGenerationHelper, literals its type mapping.SchemaScope: a closedTable | Schema | Database, for descriptors (SchemaKit: the contributor contract, so packages add schema objects instead of replacing EF services #7).TableRef.Qualify(name)for objects named within a schema.The host, one change:
SchemaKitModelDifferandSchemaKitSqlGeneratorresolve the planner and the rewriters on first use instead of taking them in the constructor. The ownership check resolves both decorators while a model is being built, and a planner needs the dialect, which reads the design-time model. The test planner now takes the dialect in its constructor on purpose.CI: an
Integration (PostgreSQL 18)lane with a service container, behind theCIgate. It writes the image digest to the summary and fails when no integration test ran.Decisions made here, for review
SK9001makes using them a deliberate opt-in until rc.1. The id is my choice.boolhole, unlike the prototype. How a boolean is spelled is the dialect's (true,ON,1).DROP … IF EXISTSis refused by the builder, at run time, by a check of the statement's text.CREATE … IF NOT EXISTSis not.E4.render-a-declarationneeds the contributor base class. The slot here isE4.identifier-not-constructible.Measure(noted on PgExclusion: exclusion constraints end to end #25).Tests
KernelProbeTests, 11 probes with an allowed twin each): a string, an object or a format in a hole, a fragment, identifier, qualified name or operator from text, the builder not constructible, the scope's missing arm and foreign case, and the contract without its opt-in. The prototype's 72 still pass.Identifierconstructor, a conversion from string, no length check, no operator check,DROP IF EXISTSallowed, an own terminator allowed, an undelimited identifier, a qualified name without its schema, the planner injected (121 tests fail on the cycle), a type without the experimental mark, the scope not closed.SCHEMAKIT_TEST_PGthe integration tests go inconclusive locally and fail whenCIis set; both were run.Not covered: SQL Server and SQLite on a live server for these statements, and a generated script through
dotnet ef, which spike B holds.Built locally on SDK
11.0.100-rc.1in a scratch copy; this PR's lanes are the run on SDK11.0.100.🤖 Generated with Claude Code