migrations: PHP 8: "PDOException: There is no active transaction"

Under PHP 8 there is Exception thrown, when transaction was autocommited. PDOException: There is no active transaction This is the change in PHP sources: https://github.com/php/php-src/commit/990bb34891c83d12c5129fd781893704f948f2f4

Ideal would be not to throw the exception if transaction was already commited.

This is similar to this issue in unrelated project: https://github.com/yiisoft/yii2/issues/18406

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Context: attempting to execute migrations with all-or-nothing enabled
Problem: migration DoctrineMigrations\Version20211017111436 is marked as non-transactional
Solution: disable all-or-nothing in configuration or by command-line option, or enable transactions for all migrations

Hey! I wrote this error message! What do you think about it?

5qq833

However, I expect that it is working by default. So when using MySQL/MariaDB/Oracle transactional should be set to false automatically, as they do not support transactional DDL-statements or at least if DDL-statements are used in a migration.

I think we have considered and rejected this in the past. You can read the very long https://github.com/doctrine/migrations/issues/1104 and all link threads, and IMO you should be able to learn more about what lead to the current situation here. Closing.

Thanks for the link @greg0ire, I understand the issue better now.