Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration Error #490

Closed
webrgp opened this issue Mar 27, 2023 · 2 comments
Closed

Migration Error #490

webrgp opened this issue Mar 27, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@webrgp
Copy link

webrgp commented Mar 27, 2023

I've stepped into this one by accident: I am working on upgrading a craft site from 3 to 4. Everything went well everything got updated.

While doing some house keeping on the plugins, I've accidentally click to uninstall Blitz and I got:

PDOException: SQLSTATE[HY000]: General error: 3730 Cannot drop table 'blitz_elementqueries' referenced by a foreign key constraint 'fk_cfxlcnhhrvopdqxahbogncwvqdbfalnxsecw' on table 'blitz_elementqueryattributes'. in /var/www/html/cms/vendor/yiisoft/yii2/db/Command.php:1302
Stack trace:
#0 /var/www/html/cms/vendor/yiisoft/yii2/db/Command.php(1302): PDOStatement->execute()
#1 /var/www/html/cms/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute('DROP TABLE IF E...')
#2 /var/www/html/cms/vendor/craftcms/cms/src/db/Migration.php(335): yii\db\Command->execute()
#3 /var/www/html/cms/vendor/putyourlightson/craft-blitz/src/migrations/Install.php(57): craft\db\Migration->dropTableIfExists('{{%blitz_elemen...')
#4 /var/www/html/cms/vendor/craftcms/cms/src/db/Migration.php(82): putyourlightson\blitz\migrations\Install->safeDown()
#5 /var/www/html/cms/vendor/craftcms/cms/src/db/MigrationManager.php(294): craft\db\Migration->down(true)
#6 /var/www/html/cms/vendor/craftcms/cms/src/base/Plugin.php(165): craft\db\MigrationManager->migrateDown(Object(putyourlightson\blitz\migrations\Install))
#7 /var/www/html/cms/vendor/craftcms/cms/src/services/Plugins.php(620): craft\base\Plugin->uninstall()
#8 /var/www/html/cms/vendor/craftcms/cms/src/controllers/PluginsController.php(79): craft\services\Plugins->uninstallPlugin('blitz')
#9 [internal function]: craft\controllers\PluginsController->actionUninstallPlugin()
#10 /var/www/html/cms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /var/www/html/cms/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#12 /var/www/html/cms/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('uninstall-plugi...', Array)
#13 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(302): yii\base\Module->runAction('plugins/uninsta...', Array)
#14 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(627): craft\web\Application->runAction('plugins/uninsta...', Array)
#15 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(281): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#16 /var/www/html/cms/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#17 /var/www/html/cms/web/index.php(13): yii\base\Application->run()
#18 {main}

Next yii\db\Exception: SQLSTATE[HY000]: General error: 3730 Cannot drop table 'blitz_elementqueries' referenced by a foreign key constraint 'fk_cfxlcnhhrvopdqxahbogncwvqdbfalnxsecw' on table 'blitz_elementqueryattributes'.
The SQL being executed was: DROP TABLE IF EXISTS `blitz_elementqueries` in /var/www/html/cms/vendor/yiisoft/yii2/db/Schema.php:676
Stack trace:
#0 /var/www/html/cms/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'DROP TABLE IF E...')
#1 /var/www/html/cms/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute('DROP TABLE IF E...')
#2 /var/www/html/cms/vendor/craftcms/cms/src/db/Migration.php(335): yii\db\Command->execute()
#3 /var/www/html/cms/vendor/putyourlightson/craft-blitz/src/migrations/Install.php(57): craft\db\Migration->dropTableIfExists('{{%blitz_elemen...')
#4 /var/www/html/cms/vendor/craftcms/cms/src/db/Migration.php(82): putyourlightson\blitz\migrations\Install->safeDown()
#5 /var/www/html/cms/vendor/craftcms/cms/src/db/MigrationManager.php(294): craft\db\Migration->down(true)
#6 /var/www/html/cms/vendor/craftcms/cms/src/base/Plugin.php(165): craft\db\MigrationManager->migrateDown(Object(putyourlightson\blitz\migrations\Install))
#7 /var/www/html/cms/vendor/craftcms/cms/src/services/Plugins.php(620): craft\base\Plugin->uninstall()
#8 /var/www/html/cms/vendor/craftcms/cms/src/controllers/PluginsController.php(79): craft\services\Plugins->uninstallPlugin('blitz')
#9 [internal function]: craft\controllers\PluginsController->actionUninstallPlugin()
#10 /var/www/html/cms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /var/www/html/cms/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#12 /var/www/html/cms/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('uninstall-plugi...', Array)
#13 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(302): yii\base\Module->runAction('plugins/uninsta...', Array)
#14 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(627): craft\web\Application->runAction('plugins/uninsta...', Array)
#15 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(281): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#16 /var/www/html/cms/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#17 /var/www/html/cms/web/index.php(13): yii\base\Application->run()
#18 {main}

Next craft\errors\MigrationException: An error occurred while executing the "putyourlightson\blitz\migrations\Install migration: SQLSTATE[HY000]: General error: 3730 Cannot drop table 'blitz_elementqueries' referenced by a foreign key constraint 'fk_cfxlcnhhrvopdqxahbogncwvqdbfalnxsecw' on table 'blitz_elementqueryattributes'.
The SQL being executed was: DROP TABLE IF EXISTS `blitz_elementqueries` in /var/www/html/cms/vendor/craftcms/cms/src/db/MigrationManager.php:314
Stack trace:
#0 /var/www/html/cms/vendor/craftcms/cms/src/base/Plugin.php(165): craft\db\MigrationManager->migrateDown(Object(putyourlightson\blitz\migrations\Install))
#1 /var/www/html/cms/vendor/craftcms/cms/src/services/Plugins.php(620): craft\base\Plugin->uninstall()
#2 /var/www/html/cms/vendor/craftcms/cms/src/controllers/PluginsController.php(79): craft\services\Plugins->uninstallPlugin('blitz')
#3 [internal function]: craft\controllers\PluginsController->actionUninstallPlugin()
#4 /var/www/html/cms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /var/www/html/cms/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#6 /var/www/html/cms/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('uninstall-plugi...', Array)
#7 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(302): yii\base\Module->runAction('plugins/uninsta...', Array)
#8 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(627): craft\web\Application->runAction('plugins/uninsta...', Array)
#9 /var/www/html/cms/vendor/craftcms/cms/src/web/Application.php(281): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#10 /var/www/html/cms/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#11 /var/www/html/cms/web/index.php(13): yii\base\Application->run()
#12 {main}

I hit the back button and everything still in place and working, so not a issue for me, but I figure I report it anyways.

  • Craft 4.4.5
  • Blitz 4.4.3
@webrgp webrgp added the bug Something isn't working label Mar 27, 2023
@bencroker
Copy link
Collaborator

bencroker commented Mar 28, 2023

Thanks for reporting this! Fixed in fe3f97a and released in 4.4.4. Note that you may now be missing some database tables, even though it appears that nothing changed, therefore I’d suggest you reinstall the plugin, just to be safe.

@webrgp
Copy link
Author

webrgp commented Mar 28, 2023

Will do, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants