Skip to content

It is impossible to use a user transaction during the migration process #3436

@jabacrack

Description

@jabacrack

After the latest updates in the documentation, the EF Core team clarified that user transactions can be used in manual migrations with some restrictions:
dotnet/EntityFramework.Docs#4896
https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-9.0/breaking-changes#migrations-transaction

However, the NpgsqlHistoryRepository.GetCreateIfNotExistsCommands method, which is called during each Migrator.MigrateAsync execution, sets the SuppressTransaction property to true for every SQL operation. As a result, any migration using an external transaction throws an exception:
"User transaction is not supported with a TransactionSuppressed migration or a retrying execution strategy."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions