Skip to content

Conversation

@AndriySvyryd
Copy link
Member

@AndriySvyryd AndriySvyryd commented Apr 27, 2024

Fixes #33605

Description
When an entity type is discovered as part of a TPH inheritance it gets a discriminator value assigned. If the base type is ignored later and a migration is generated EF preserves the discriminator value even though the is no corresponding discriminator property.

Customer impact
When adding another migration in the above scenario EF will generate an operation to drop the non-existing discriminator column, resulting in an error. A workaround is to manually edit the snapshot or the migration, but this would need to be done after every new migration.
While there has only been one report this affects models with an abstract unmapped base type, which is not that uncommon.

How found
Customer reported on 8.

Regression
Yes, from 7

Testing
Test added.

Risk
Low. The fix is in code that only runs as part of a design-time tool.

@AndriySvyryd AndriySvyryd requested a review from a team April 27, 2024 05:43
@SamMonoRT SamMonoRT added this to the 8.0.x milestone Apr 30, 2024
@SamMonoRT
Copy link
Member

Approved in email.
cc @maumar

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.

5 participants