Emit oldStored based on the old column in CSharpMigrationOperationGen… - #38724
Open
ilkertskn wants to merge 1 commit into
Open
Emit oldStored based on the old column in CSharpMigrationOperationGen…#38724ilkertskn wants to merge 1 commit into
ilkertskn wants to merge 1 commit into
Conversation
…erator - The oldStored: argument of a generated AlterColumn call was gated on operation.IsStored (the new column) while emitting operation.OldColumn.IsStored, so altering a column away from a stored computed column dropped oldStored: from the generated (and reverse) migration - Gate on operation.OldColumn.IsStored to match the value being written - Add a test covering alter from a stored computed column to a non-computed column
Contributor
Author
|
@dotnet-policy-service agree |
There was a problem hiding this comment.
Pull request overview
Fixes C# migration code generation for AlterColumn so oldStored: is emitted based on operation.OldColumn.IsStored (the value actually being written), preventing loss of oldStored: when altering away from a stored computed column.
Changes:
- Gate emission of
oldStored:onoperation.OldColumn.IsStoredinstead ofoperation.IsStored. - Add a regression test covering altering from a stored computed column to a non-computed column and ensuring
oldStored:is preserved.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/EFCore.Design/Migrations/Design/CSharpMigrationOperationGenerator.cs | Fixes the conditional that controls whether oldStored: is emitted for AlterColumn. |
| test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationOperationGeneratorTest.cs | Adds a regression test ensuring oldStored: is generated when removing a stored computed column. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…erator