oveleon / contao-component-style-manager

This extension is for the Contao CMS and allows you to easily manage and provide custom categories and groups for CSS classes.
MIT License
23 stars 6 forks source link

Unbuffered queries in ObjectConversionMigration #71

Closed rabauss closed 1 year ago

rabauss commented 2 years ago

Unfortunately, the migration for v3 ends with the following error Cannot execute queries while other unbuffered queries are active in some of my contao instances while running contao-console contao:migrate (with backup!).

Exception trace:
  at /httpdocs/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28
 Doctrine\DBAL\Driver\PDO\Exception::new() at /httpdocs/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:74
 Doctrine\DBAL\Driver\PDO\Connection->query() at /httpdocs/vendor/doctrine/dbal/src/Connection.php:1065
 Doctrine\DBAL\Connection->executeQuery() at /httpdocs/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php:284
 Contao\Database\Statement->query() at /httpdocs/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php:240
 Contao\Database\Statement->execute() at /httpdocs/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php:1174
 Contao\Model::countBy() at /httpdocs/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php:1184
 Contao\Model::countAll() at /httpdocs/vendor/oveleon/contao-component-style-manager/src/StyleManager/Sync.php:43
 Oveleon\ContaoComponentStyleManager\StyleManager\Sync->shouldRunObjectConversion() at /httpdocs/vendor/oveleon/contao-component-style-manager/src/Migration/Version30/ObjectConversionMigration.php:48
 Oveleon\ContaoComponentStyleManager\Migration\Version30\ObjectConversionMigration->shouldRun() at /httpdocs/vendor/contao/core-bundle/src/Migration/MigrationCollection.php:47
 Contao\CoreBundle\Migration\MigrationCollection->getPending() at /httpdocs/vendor/contao/core-bundle/src/Migration/MigrationCollection.php:58
 Contao\CoreBundle\Migration\MigrationCollection->getPendingNames() at /httpdocs/vendor/contao/core-bundle/src/Command/MigrateCommand.php:257
 Contao\CoreBundle\Command\MigrateCommand->executeMigrations() at /httpdocs/vendor/contao/core-bundle/src/Command/MigrateCommand.php:208
 Contao\CoreBundle\Command\MigrateCommand->executeCommand() at /httpdocs/vendor/contao/core-bundle/src/Command/MigrateCommand.php:109
 Contao\CoreBundle\Command\MigrateCommand->execute() at /httpdocs/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /httpdocs/vendor/symfony/console/Application.php:1058
 Symfony\Component\Console\Application->doRunCommand() at /httpdocs/vendor/symfony/framework-bundle/Console/Application.php:96
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /httpdocs/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /httpdocs/vendor/symfony/framework-bundle/Console/Application.php:82
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /httpdocs/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /httpdocs/vendor/contao/manager-bundle/bin/contao-console:38
 include() at /httpdocs/vendor/bin/contao-console:120

this trace leads me to this line: https://github.com/oveleon/contao-component-style-manager/blob/cc737da7767356b1c98376dedbb7a5ab03ba3014/src/StyleManager/Sync.php#L43

this count line should get refactored - but I'm not sure how 😞 Maybe @fritzmg can help?

seems to be related to : https://contao.slack.com/archives/CK4J0KNDB/p1664471331144309 https://contao.slack.com/archives/CK4J0KNDB/p1665012397236239

doishub commented 2 years ago

After reading the messages in Slack, I made a few adjustments. Could you test again with this branch?

https://github.com/oveleon/contao-component-style-manager/tree/bugfix/migration

rabauss commented 2 years ago

Looking good to me!

doishub commented 1 year ago

Fixed in 3.0.2