Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/7.0] Update discriminator columns when PK-to-PK dependent type is changed #29920

Merged
merged 3 commits into from
Jan 4, 2023

Conversation

ajcvickers
Copy link
Contributor

@ajcvickers ajcvickers commented Dec 22, 2022

Port of #29876
Fixes #29789

Description

EF generates an update when a dependent entity is deleted and replaced with a new entity that has the same PK. If that new entity is of a different type, then the discriminator column must be updated, but this is not happening in EF7.

Customer impact

Database contains rows that represent the wrong type of object; so potentially data corruption.

How found

Customer reported on 7.0

Regression

Yes, from EF Core 6.0.

Testing

Added tests for the affected scenario and related.

Risk

Low; the fix is simple, and a quirk was added to revert back to older behavior.

@ajcvickers ajcvickers requested a review from a team December 22, 2022 20:18
@AndriySvyryd AndriySvyryd changed the title [release/7/0] Update discriminator columns when PK-to-PK dependent type is changed [release/7.0] Update discriminator columns when PK-to-PK dependent type is changed Dec 23, 2022
AndriySvyryd
AndriySvyryd approved these changes Dec 23, 2022
@ajcvickers ajcvickers added this to the 7.0.x milestone Dec 23, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.x, 7.0.3 Jan 4, 2023
@wtgodbe wtgodbe merged commit bda2487 into release/7.0 Jan 4, 2023
@wtgodbe wtgodbe deleted the AnotherCupOfPKTips1222 branch January 4, 2023 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants