Repository navigation
Description
2026-11-25: in PR #199 (feat/198-effects-seam). Offline: 772 of the kernel's tests, 209 of the PostgreSQL package's, 90 of the second provider's; the API probes' 127. Live: 4 and 77 on PostgreSQL 16 and on 18, 86 on SQL Server 2022, the consumer smoke test's 47 rows.
What is there:
ISchemaDialect.EffectOf(MigrationOperation)answers with anOperationEffect, a closed union:Changes(theBaseChanges the operation stands for; none for one that touches nothing an object depends on),NotWritten(the tables it is about and the way out, as a sentence of the provider's package),Unknown. The planner asks it of every operation, in their order.- The kernel's
SchemaDialectanswers EF Core Relational's operations, and SQL Server's and SQLite's as before. NpgsqlSchemaDialectsays Npgsql's own: a change of a generatedtsvectoris a dropped column, its database operations touch nothing, and a table moved back to the default schema is not written. Each is held against Npgsql's generator inNpgsqlOperationEffectTests.- The planner refuses an operation that is not written when a declared object, on either side, is on one of its tables (A table moved back to the default schema stays where it was on Npgsql, and a statement written after the move fails with 42P01 #105). The way out for Npgsql is to name the schema,
ToTable("x", "public");Moving_the_table_back_with_the_default_schema_namedapplies that on PostgreSQL 16 and 18 and finds the table and its constraint whereEnsureCreated()puts them. Taking the name off again afterwards is no move. - A context that declares nothing on the table is not touched.
Deviations from the proposal on #116:
- The second provider's probe dialects do not override the seam. They have no rule to say that the kernel's dialect lacks, so an override would change nothing a test could see.
The_dialect_says_what_an_operation_doesandAn_operation_of_another_package_is_taken_when_the_dialect_describes_ithold the seam in the kernel's tests with a dialect of their own. NotWrittencarries the way out. Only the provider's package knows it, and a refusal without it names no fix.- No service by which a third package describes its operation types. A dialect can describe them, as the test shows; a second way in waits for a package that needs it.
Nine rules were changed in turn, each run with the live tests on PostgreSQL 18, and a test failed for each:
| Changed | Fails |
|---|---|
| The planner asks the kernel's table, not the dialect | both of the kernel's seam tests, the refusal's |
| An operation that is not written is passed over | The_dialect_says_what_an_operation_does, the refusal's |
| It is refused whatever is on its table | The_dialect_says_what_an_operation_does |
| An unknown operation is taken for harmless | two of the kernel's |
| A move the dialect names does not carry names forward | three of the PostgreSQL package's |
Npgsql: a changed tsvector is an alteration |
two rows of The_dialect_says_a_dropped_column_where_the_generator_drops_one (the first form of this change was no change, and was redone) |
| Npgsql: the move back is a move | two |
| Npgsql: leaving the default schema's name is not written either | three, the live test among them |
| Npgsql: its database operations are unknown | Every_operation_type_of_Npgsql_is_described |
Part of #116 (decided 2026-11-25): the slice for preview.2. Takes #105's refusal with it.
Problem
What a MigrationOperation does to the database is the provider's rule, and the kernel holds copies of three providers' rules. A provider's package has no way to say what its generator does otherwise, and Npgsql's move back to the default schema, for which its generator writes no statement (measured on 11.0.0), has nowhere to be said: the planner takes the table for moved (#105).
Change
ISchemaDialectgets one member that turns aMigrationOperationinto theBaseChanges it stands for, or says it does not know the operation. The kernel'sSchemaDialectanswers as the kernel does today. A provider's dialect overrides it.- Npgsql's rules move to
NpgsqlSchemaDialect: its own operation types, thetsvectorpart of the drop-and-add rule, and the move back to the default schema, which it says is not written. - A move that is not written is refused when a model declares an object on that table, with the table named and the way to write the move by hand.
- The second provider's probe dialects override the member for a rule each.
Not here: SQLite's and SQL Server's rules stay in the kernel until each has a dialect to move to (#29, the first SQLite object), and with them the convention test that no provider is named under the kernel's src. A service by which a third package describes its own operation types is not built until there is one to describe.
Done when
The PostgreSQL package's tests hold each of Npgsql's rules against its generator, a live test shows the table moved back by hand ends where EnsureCreated() puts it, and the refusal's test fails without the rule.
Activity