Skip to content

Conversation

@AndriySvyryd
Copy link
Member

@AndriySvyryd AndriySvyryd commented Aug 26, 2025

Fixes #35096

Description
In EF9 we changed migration execution to use a single transaction across all migrations to rollback everything if there are any errors. However, many operations fail when executed in the same transaction. Also, a long-running transaction is more likely to fail due to transient errors.
So, this PR reverts the behavior to pre-EF9.

Customer impact
Certain operations now fail when several migrations are applied at once. A workaround is to apply one migration at a time.

How found
This was reported by several customers

Regression
Yes, from EF 8.0.x. Introduced in 972a50a

Testing
Tested manually

Risk
Low. Targeted change that reverts to previous behavior.

@artl93
Copy link
Member

artl93 commented Aug 26, 2025

@AndriySvyryd - Should this be considered a breaking change?

Copy link
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

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

(See comment about breaking change)

@AndriySvyryd
Copy link
Member Author

@AndriySvyryd - Should this be considered a breaking change?

We've discussed this with the team and couldn't come up with any reasonable scenario that would be broken by this change.

…n possible)

GenerateScript will still try to execute everything in a single transaction.

Fixes #35096
@AndriySvyryd AndriySvyryd enabled auto-merge (squash) August 27, 2025 19:09
@AndriySvyryd AndriySvyryd merged commit a899d64 into release/10.0 Aug 27, 2025
7 checks passed
@AndriySvyryd AndriySvyryd deleted the Issue35096 branch August 27, 2025 19:52
@enijburg-ib
Copy link

Can this be cherrypicked to EF/9 so the issue is fixed there as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EF9: single transaction spanning all migrations causes transaction-incompatible SQL to fail

5 participants