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

[5.0.1] Generate the correct overload for excluding tables for owned types. #23178

Merged
merged 2 commits into from Nov 12, 2020

Conversation

AndriySvyryd
Copy link
Member

@AndriySvyryd AndriySvyryd commented Nov 3, 2020

Fixes #23137

Description

The fix does the following:

  • Generate the correct overload for excluding tables for owned types.
  • Don't generate DropForeignKey or data operations for excluded tables.
  • Don't set excluded from migrations to false if it was not specified.

Customer Impact

When an owned entity type is excluded from migrations we generate an incorrect API call in the model snapshot that needs to be fixed manually. And when the next migration is created a DropForeignKey operation is generated for the foreign key to owner even though no operations should be created for tables excluded from migrations. This operation needs to be removed manually.

If both the owner and owned types are mapped to the same table and only the owner is excluded the generated snapshot throws an exception and needs to be fixed manually.

How found

Reported by user on RC2

Test coverage

This PR includes tests for the affected scenario.

Regression?

No, this only affects exclude table from migrations - a new feature in 5.0

Risk

Low. The fix only affects models with table excluded from migrations and the modified code is used only at design-time.

@AndriySvyryd AndriySvyryd requested a review from a team November 3, 2020 17:20
@ajcvickers ajcvickers added this to the 5.0.x milestone Nov 3, 2020
@leecow leecow modified the milestones: 5.0.x, 5.0.1 Nov 3, 2020
@ajcvickers
Copy link
Member

Approved by Tactics for 5.0.1.

Copy link
Member

@smitpatel smitpatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably @bricelam should also take a look

@ajcvickers
Copy link
Member

@AndriySvyryd Approved by Tactics for 5.0.1.

Don't generate DropForeignKey or data operations for excluded tables.
Don't set excluded from migrations to false if it was not specified.

Fixes #23137
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.

None yet

5 participants