It is impossible to use a user transaction during the migration process
After the latest updates in the documentation, the EF Core team clarified that user transactions can be used in manual migrations with some restrictions: https://github.com/dotnet/EntityFramework.Docs/issues/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."
I plan to reexamine the strategy here in #3407, will look at this at the same time.