Repository navigation
feat: an object that follows EF Core's renames is compared under the new names, so a rename does not rebuild it - #70
Merged
Conversation
…new names, so a rename does not rebuild it The resolver takes EF Core's renames for the source side of a diff: a fragment's SQL and what it reads take the table and the columns as the target names them, and a default name is still built from the source's own. The planner asks ImpactOf with the object as it is. When every rename that touches it is answered Follows, the declaration is resolved again under the new names and that is matched against the target. An object with an explicit name then equals the target's; one with a default name differs in the name alone, which is the contributor's InPlace rename. A drop names the object as it is before EF Core's operations. Closes #69 Co-Authored-By: Claude Fable 5.2 <[email protected]>
This was referenced Nov 12, 2026
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 #69
The third slice of #24 and the rename part of #43. Both stay open for what is listed on them.
Problem
Impact.Followswas taken as "leave it". The source side of a diff was resolved under its own model's names, so an object on a renamed table, or one that reads a renamed column, differed from the target's and was dropped and created: a rebuild under a lock for a rename the database follows by itself (spike E, #20).Change
Resolution/Internal/ModelSchemaResolver.cstakesISchemaRenames. Under themTableis the table as the target names it, and a fragment's SQL and its dependencies take the target's column names. A default name is still built from the model's own table and columns (NamedAfter, and each part's name token).Migrations/Internal/BaseChanges.csis theISchemaRenamesof a diff: it already carried tables and columns forward for matching changes to dependencies.Migrations/Internal/SchemaOperationPlanner.cs.ImpactOfis asked for every source object with the object as it is. When every rename that touches it is answeredFollows, its declaration is resolved again under the renames, and that descriptor is matched against the target:InPlacerename, after EF Core's operations, as EF Core renames its own indexes.Resolved.Before), since drops run before them.Followsto a rename leaves the object compared as it was, which is the contributor's to plan as before.A contributor is now asked about every source object an operation touches, also one that is dropped anyway.
Tests
Kernel tests without a server, on SDK 11.0.100 in the checkout: 376 before, 380 after. Probes: 125 pass. The PostgreSQL integration tests did not run locally; CI runs them.
Two tests that held the old behaviour are rewritten:
An_object_on_a_renamed_table_is_dropped_and_createdis now part ofAn_object_that_follows_a_rename_is_not_touched, and theFollowsrow ofA_changed_object_is_not_planned_when_the_operation_decidesexpects EF Core's rename alone.New: a renamed column, a renamed table and both leave an index with an explicit name alone; an index with a default name gets one
ALTER INDEX … RENAMEafter EF Core's operations; an answer ofUnaffectedto a rename is compared as it was; a trigger rebuilt next to a table rename is droppedON "Thing"and createdON "Things"; and at the resolver, under renames the SQL and the dependencies take the new names while the default name equals the one without renames.Each rule undone in a scratch copy:
FollowsrowAn_object_that_does_not_follow_a_rename_is_compared_as_it_wasA_drop_names_the_object_as_it_is_before_ef_cores_operationsFollowsrowOne more was undone and nothing failed: not resolving again when the object is also lost or rebuilt around. Either way the same statements come out, so the condition is removed and not tested.
🤖 Generated with Claude Code