[5.0.3] Correctly distinguish between seeds for different owned types #23863
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 #23792
Description
Migrations compared seed data based on the column information, meaning that data was matched as long as the values were mapped to the same columns and in the case of table sharing in some cases this caused data to be mismatched between different entity types. And if one of the types has a read-only property (an alternate key) this results in the row being deleted and inserted again unnecessarily.
Customer Impact
A migration for a model that matches the above condition will always contain operations even if the model hasn't changed. There is no workaround other than removing the read-only properties or manually fixing the migrations.
How found
Customer reported on 5.0.1.
Test coverage
We have added more test coverage in this PR.
Regression?
Yes.
Risk
Low. The fix only affects migrations for models with table sharing and read-only properties.