DoctrineMigrationsBundle: "There is no active transaction" error after successfully performing migrations
Problem
When performing migrations, the process ends with “There is no active transaction” thrown in Connection.php on line 1761. The migrations themselves are performed successfully: the database schema appears to be altered as expected, and when re-running migrations Doctrine is aware that all migrations have been run successfully previously already.
The problem occurred for the first time after the migration from PHP 7.4 to 8.0.0.
The problem occurs when performing migrations through the doctrine:migrations:migrate command, as well as when performed in code by dama/doctrine-test-bundle.
Update 2021-01-05
This may be a pdo_mysql issue. See https://twitter.com/derrabus/status/1346405883429924870
Package versions
- doctrine/migrations 3.0.2
- doctrine/doctrine-migrations-bundle 3.0.2
- doctrine/dbal 2.12.1
Related issues
- https://twitter.com/derrabus/status/1346405883429924870
- https://github.com/doctrine/dbal/pull/4452 has the same error under similar circumstances, but proposed the wrong fix.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Change doctrine version to attempt to fix "There is no active transaction" https://github.com/doctrine/DoctrineMigrationsBundle/issues/393#issuecomment-853092604 — committed to NoxZet/symfony-docker by NoxZet 4 years ago
- Change doctrine version to attempt to fix "There is no active transaction" https://github.com/doctrine/DoctrineMigrationsBundle/issues/393#issuecomment-853092604 — committed to NoxZet/symfony-docker by NoxZet 4 years ago
IF YOU STILL GET THIS ERROR
if you use Doctrine Migrations Bundle make sure to update the bundle to ^3.1.1 version (but first update the doctrine migrations library); for both of these, run this single command
if you use Doctrine Migrations directly, without bundle, as prompted by @azjezz
I don’t think there is anything to follow, because there is nothing we should do IMO. You can get an in-depth explanation about implicit commits here though: https://github.com/doctrine/migrations/pull/1157/files
A temporary workaround would be to override
isTransactional()to returnfalse- if not having a transaction is acceptable for your migrations.Thank @greg0ire. I solved by splitting my sql (one with table deletion/creation and one with everything else)
@greg0ire would a PR adding the option
transactionalin the bundle config be accepted?(Mb, I saw it’s already done, just not compatible with dbal 2.x 🙈 )
Duplicate of https://github.com/doctrine/migrations/issues/1104