Skip to content

Emit oldStored based on the old column in CSharpMigrationOperationGen… - #38724

Open
ilkertskn wants to merge 1 commit into
dotnet:mainfrom
ilkertskn:fix/csharp-migration-operation-generator-oldstored
Open

Emit oldStored based on the old column in CSharpMigrationOperationGen…#38724
ilkertskn wants to merge 1 commit into
dotnet:mainfrom
ilkertskn:fix/csharp-migration-operation-generator-oldstored

Conversation

@ilkertskn

@ilkertskn ilkertskn commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

…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
  • I've read the guidelines for contributing and seen the walkthrough
  • I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • The code builds and tests pass locally (also verified by our automated build checks)
  • Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • Tests for the changes have been added (for bug fixes / features)
  • Code follows the same patterns and style as existing code in this repo

…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
@ilkertskn
ilkertskn requested a review from a team as a code owner July 30, 2026 21:51
@ilkertskn

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

@AndriySvyryd
AndriySvyryd requested a review from Copilot July 30, 2026 22:47
@AndriySvyryd AndriySvyryd self-assigned this Jul 30, 2026
@AndriySvyryd AndriySvyryd added this to the 12.0.0 milestone Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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: on operation.OldColumn.IsStored instead of operation.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.

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.

3 participants