Skip to content

Conversation

@bricelam
Copy link
Contributor

@bricelam bricelam commented Oct 23, 2020

Fixes #23045

Description

In EF Core 5.0, we fixed issue #21364 which sometimes omitted the ALTER COLUMN statement when it was not needed. Unfortunately, migrations generated using versions of EF Core prior to version 3.1.0 don't contain enough information to always know whether or not the column type was actually changed. This results in the ALTER COLUMN statement being erroneously omitted.

Customer Impact

Anyone with migrations generated prior to EF Core 3.1 who try to apply them using EF Core 5.0 may run into this issue. Their column type will not be changed as expected which can lead to subsequent issues (as reported in the original issue).

How found

Customer reported

Test coverage

We have tests that cover migrations generated using EF Core 3.1 but they didn't cover this specific scenario. This PR adds additional coverage for it.

Regression?

Yes.

Risk

Low. This merely reverts to the behavior of previous versions (i.e. includes the ALTER TABLE statement) when the old column type is null/unknown.

@bricelam bricelam requested a review from a team October 23, 2020 22:04
The fix for dotnet#21364 broke migrations created prior to version 3.1.0 which did not specify the old column type. In this case, we don't know whether the column was previously part of an index or not, so we should always include the ALTER COLUMN statement just in case. Note, the old column type is always specified for migrations created with versions 3.1.0 and newer.

Fixes dotnet#23045
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.

2 participants