Repository navigation
feat: the planner's first slice, declarations on both sides matched, planned and ordered around EF Core's operations - #64
Merged
Conversation
…planned and ordered around EF Core's operations SchemaOperationPlanner replaces NoSchemaOperations. It reads every declaration of the source and the target model through its contributor and the kernel's resolver, takes equal descriptors of one contributor for one object, pairs the rest by kind, scope and name and then by equality but for the name, asks the contributor for its plan, and orders the statements: drops, EF Core's operations, in-place statements, creates, by placement. A declaration whose owner has no contributor is refused. A context that declares nothing never builds the dialect. EF Core's operations are not read yet; that stays in #24. Closes #63 Co-Authored-By: Claude Fable 5.2 <[email protected]>
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 #63
The first slice of #24, which stays open.
Problem
The host splices what an
ISchemaOperationPlannerreturns around the inner differ's operations, and the kernel's only planner wasNoSchemaOperations. A stored declaration never became a statement outside the tests' stand-in.Change
Migrations/Internal/SchemaOperationPlanner.cs, internal, in place ofNoSchemaOperations:IDeclarationSource, whichSchemaContributor<,>implements; the registry takes no contributor that does not derive from it (A contributor that implements ISchemaContributor directly passes the base class's refusals by #48).Planper pair:Noneadds nothing,InPlacethe statements written,Rebuilda drop and a create.BeforeTablescontributor is created before and dropped after, and aRebuildfrom one is refused.Found while writing the checks below: two contributors may share a descriptor type, and plain descriptor equality took a unique index and a plain index of the same name and column for one object. Equality now asks for the same contributor, with a test.
Two existing tests changed because scaffolding now runs the real planner:
SnapshotRoundTripTestsregisters the contributor its declarations belong to, and declares its trigger under epoch 1 (another epoch surviving the stored form stays withDeclarationCodecTests).Not here (stays in #24)
BaseChange, andImpactOf. Until then a descriptor that reads a renamed column or table is rebuilt, and an object the database loses while both models declare it unchanged (SQLite's table rebuild) is not created again. No contributor for SQLite should ship before that slice;CLAUDE.mdsays so.MigrationOperationtype and the error for one outside it.Dependency.SchemaObject.Harness/TestKit.cs, which the host's own tests still use.Tests
Kernel tests without a server, on SDK 11.0.100 in the checkout: 326 before, 343 after. Probes: 125 pass. The PostgreSQL integration tests did not run locally; CI runs them.
SchemaOperationPlannerTestsdrives the real host with three sample contributors (after the tables at 5 and at 10, and before the tables). A model against its own compiled snapshot gives no operation on Npgsql, SQL Server and SQLite, and the same test shows it is not vacuous: from no model, and to no model, each declaration is a statement.Each rule undone in a scratch copy:
Equal_descriptors_of_two_contributors_are_two_objectsNonetest, the in-place-order test, the before-tables testA_context_that_declares_nothing_never_builds_the_dialect🤖 Generated with Claude Code