Repository navigation
Place complex property columns in CLR property order when creating tables - #39163
Merged
AndriySvyryd merged 1 commit intoOct 8, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is localized, recursively handles nested complex properties, preserves explicit ordering, and has appropriate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Updates migrations table creation to order complex-property columns according to CLR declaration order, matching owned and table-split entities.
Changes:
- Recursively integrates complex properties into column sorting.
- Adds direct and nested complex-property ordering tests.
- Updates relational assertions and provider SQL baselines.
| File | Description |
|---|---|
src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs |
Adds recursive complex-property ordering. |
test/EFCore.Relational.Tests/Migrations/Internal/MigrationsModelDifferTest.cs |
Tests direct and nested ordering. |
test/EFCore.Relational.Specification.Tests/Migrations/MigrationsTestBase.cs |
Updates shared ordering expectations. |
test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.cs |
Updates SQL Server baselines. |
test/EFCore.Sqlite.FunctionalTests/Migrations/MigrationsSqliteTest.cs |
Updates SQLite baselines. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
AndriySvyryd
approved these changes
Oct 8, 2026
AndriySvyryd
left a comment
Member
There was a problem hiding this comment.
Thanks for your contribution!
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.
Fixes #31259
When generating a CreateTable operation, columns that come from complex properties were always added at the end of the table and sorted by name. Owned types and table-split entities already have their columns placed where the navigation sits in the CLR type; complex properties now get the same treatment. The columns of a complex property, including nested complex properties, are placed at the position of that property in the CLR type, in the declaration order of the complex type. Complex properties without a CLR property still go last, and explicit column order still wins.
Adds the test from the issue plus a nested complex type case, and updates the existing migration tests and SQL baselines whose expected column order changes (only the order changes).