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] Fix making column required on SQL Server with idempotent migrations #29784

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

roji
Copy link
Member

@roji roji commented Dec 6, 2022

Fixes #29530, backports #29619

Description

Before EF 7.0, making a column non-nullable which contained nulls would fail. EF 7.0 added an UPDATE statement to convert nulls to a default value, but the SQL wasn't properly escaped.

Customer impact

Making a column non-nullable can cause the migration to fail in certain scenarios (when the column is renamed).

How found

Customer reported on 7.0

Regression

Partial; this scenario used to work correctly as long as the column contained no nulls. When nulls were present, this already caused a failure (null constraint violation).

Testing

Added a test for the affected scenario.

Risk

Very low; the fix is trivial and affects migrations only (no runtime impact). A quirk was added to revert back to older behavior.

@roji roji requested a review from a team December 6, 2022 16:28
@roji roji force-pushed the MakeColumnRequiredIdempotent7 branch from 166e7da to b06d3dc Compare December 7, 2022 11:24
@rbhanda rbhanda added this to the 7.0.3 milestone Dec 8, 2022
@wtgodbe wtgodbe merged commit a00c229 into dotnet:release/7.0 Jan 4, 2023
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