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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

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

composer update doctrine/migrations && composer require doctrine/doctrine-migrations-bundle:^3.1.1

if you use Doctrine Migrations directly, without bundle, as prompted by @azjezz

If you are using doctrine migrations 2, run the following:

composer require doctrine/migrations:^2.3.3

If you are using doctrine migrations 3, run the following:

composer require doctrine/migrations:^3.1.1

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 return false - 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 transactional in the bundle config be accepted?

(Mb, I saw it’s already done, just not compatible with dbal 2.x 🙈 )