Repository navigation
Description
2026-11-12, merged (PR #70, closed #69): renames under Follows. An object that follows every rename that touches it is resolved again under the names the target gives its table and columns and compared as that, so a renamed table or column no longer rebuilds what reads it; a default name becomes one InPlace rename. Still open here: ordering by Dependency.SchemaObject; deleting the stand-in planner in Harness/TestKit.cs; a way for another package to say what its own operation type does; and for SQLite, placing a create after a table rebuild (plan 3.12).
2026-11-12, merged (PR #66, closed #65): the second slice. EF Core's operations are BaseChanges (BaseChanges, with a table of every operation type and a convention test), ImpactOf is asked for each change that touches what an object depends on, and RebuildAround and Lost are acted on, also for an object both models declare unchanged. An operation of an unknown type is refused when a model declares an object.
Still open here: Follows as resolving the source side under a renamed table or column (with #43; until then an object on a renamed table is dropped and created); ordering by Dependency.SchemaObject; deleting the stand-in planner in Harness/TestKit.cs; a way for another package to say what its own operation type does. And for SQLite, with the generator decorator (plan 3.12): a create after a table rebuild runs before the rebuild, because SQLite's generator moves the rebuild to the end of the migration, so such a migration fails to apply.
2026-11-12, merged (PR #64, closed #63): the first slice. SchemaOperationPlanner replaces NoSchemaOperations: it reads the declarations of both models through their contributors and the kernel's resolver, matches descriptors (equal, then kind, scope and name, then equal but for the name), asks Plan per pair and orders drops, EF Core's operations, in-place statements and creates by placement. A declaration whose owner has no contributor is refused (#22 adds the way out).
Still open here: EF Core's operations as BaseChange and ImpactOf with the measured table of section 3.7, the source side under renamed tables and columns (with #43), the table of every MigrationOperation type and the error for one outside it, ordering by Dependency.SchemaObject, and deleting the stand-in planner in Harness/TestKit.cs. Until the first of these, an object the database loses while both models declare it unchanged (SQLite's table rebuild) is not created again.
2026-11-12, from spike E (#20, PR #60): the impact table is measured, and it has an outcome the union does not. The table is in the plan, section 3.7 once #60 merges. Decided 2026-11-12 (#61): the case is renamed to Impact.RebuildAround, which a contributor answers both for an operation that fails while the object exists and for one that leaves it broken. What was to decide: a trigger whose body reads a column survives the column's rename and drop in the catalog, on PostgreSQL and on SQL Server, and fails when it next fires. That is none of Unaffected, Follows, Lost and Blocks. Lost would leave the broken trigger in place. Blocks has the right action (drop before EF Core's operations, create after) although the operation does not fail, so either Blocks is documented as "rebuild around the operation" or it is renamed. Also from the table: an AlterColumnOperation that changes only nullability is a type change on PostgreSQL as Npgsql writes it, so ColumnAltered cannot be split by what changed without reading the generator; and PostgreSQL drops an index with a column that is only in its predicate, in silence.
From #42, 2026-11-11. The planner may take ISchemaDialect and anything else that needs the model in its constructor: the host resolves the planner on first use, not while the model is being built. The differ and the generator themselves must stay free of such dependencies, because the ownership check resolves them during model building; injecting the planner there made 121 tests fail on the cycle. Statements are written through SchemaSql, which appends the terminator.
From #40, 2026-11-11: the seam this plugs into exists. The host asks an internal ISchemaOperationPlanner.Plan(source, target, inner) for a SchemaOperationPlan(Before, After) and splices it around the inner differ's operations; HasDifferences runs the same plan. The planner of this issue replaces NoSchemaOperations (registered with TryAddScoped). test/CodoMetis.EFCore.SchemaKit.Tests/Harness/TestKit.cs is a stand-in to delete when it does.
Part of preview.1. Plan, sections 3.6 and 3.7. Its table comes from #20.
Change
- Matching: exact descriptor equality; then pairs on
(kind, scope, resolved name); then equality modulo name; the rest are drops and creates. Plan(from, to)per changed pair:None,InPlace(statements),Rebuild.- EF's operations normalised into a closed
BaseChange(ColumnRenamed,ColumnAltered,ColumnDropped,TableRenamed,TableMoved,TableDropped,TableRebuilt);ImpactOfper descriptor and change. - Order: drops and rebuild-drops, the inner differ's operations untouched, in-place statements, creates and rebuild-creates; dependents and dependencies ordered topologically.
- A table of every
MigrationOperationtype in EF Core Relational and the providers, each mapped or marked harmless. A type outside it that touches a table with SchemaKit objects is an error naming the type.
Done when
The catalog-equivalence oracle (#32) is green for generated pairs over these operations, and a convention test fails when a provider assembly gains an operation type the table does not know.
Activity
CaffeinatedCoder commentedon Nov 14, 2026
From the pre-preview sweep of
main@ 948496a, 2026-11-14. #98 (what "target" means when EF Core diffs Down) and #99 (a rename in place frees its name too late) are the planner's two defects of this sweep. Beside them:BeforeTablescreate is written before all of EF Core's operations,EnsureSchemaincluded. A domain in a schema the same migration creates would precede its schema. Read, not run; no shipped contributor is placed before tables. It belongs with the ordering byDependency.SchemaObject.ImpactOf(ColumnDropped)under a table rename compares the descriptor's column, which names the old table, with the operation's, which names the new one. An element's column dropped together with a table rename is answeredRebuildAroundwhereLostwas meant. The outcome is right, since a drop before and a create after always is. Noted because the same mismatch the other way round would be wrong, and no input was found that produces it.EnsureCreated(): two constraints swapping names (also on a renamed table), a rename chain, a table rename with an explicit name change, a table rename with an element's column renamed and the condition's dropped,HasDefaultSchemaset, a table name changed in case only, the declaration moved to a new table while another entity takes the old one. The two moves back to the default schema are 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.CaffeinatedCoder commentedon Nov 25, 2026
Ordering by
Dependency.SchemaObject, which this issue still listed as open, is built with #195 (PR #196): a create after the creates of what it needs, a drop before their drops, a circle refused, and the dependency carries the object's scope. Still open here: deleting the stand-in planner inHarness/TestKit.cs, and a way for another package to say what its own operation type does (#116). Placing a create after SQLite's rebuild is #115's slice D; until then such a create is refused (#145).