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

[5.x]: Upgrading from 4 -> 5 failed to apply m240302_212719_solo_preview_targets #15555

Closed
23d1 opened this issue Aug 18, 2024 · 1 comment
Closed
Labels

Comments

@23d1
Copy link

23d1 commented Aug 18, 2024

What happened?

Description

I'm upgrading from Craft 4 to 5 and have followed the upgrade guide and when I go to run php craft up, during migrations I get;

*** applying m240129_150719_sites_language_amend_length
    > alter column language in table {{%sites}} to string NOT NULL ... done (time: 0.016s)
*** applied m240129_150719_sites_language_amend_length (time: 0.019s)

*** applying m240206_035135_convert_json_columns
    > alter column traces in table {{%deprecationerrors}} to json ... done (time: 0.006s)
    > alter column config in table {{%fieldlayouts}} to json ... done (time: 0.019s)
    > alter column scope in table {{%gqlschemas}} to json ... done (time: 0.007s)
    > alter column previewTargets in table {{%sections}} to json ... done (time: 0.014s)
    > alter column preferences in table {{%userpreferences}} to json ... done (time: 0.006s)
    > alter column settings in table {{%widgets}} to json ... done (time: 0.006s)
*** applied m240206_035135_convert_json_columns (time: 0.062s)

*** applying m240207_182452_address_line_3
    > add column addressLine3 string AFTER `addressLine2` to table {{%addresses}} ... done (time: 0.003s)
*** applied m240207_182452_address_line_3 (time: 0.006s)

*** applying m240302_212719_solo_preview_targets
Exception: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
The SQL being executed was: INSERT INTO `elements_bulkops` (`elementId`, `key`, `timestamp`) VALUES (7, 'bbvhcpbvku', '2024-08-18 22:25:44') ON DUPLICATE KEY UPDATE `timestamp`=VALUES(`timestamp`) (/Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException(Object(PDOException), 'INSERT INTO `el...')
#1 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute('INSERT INTO `el...')
#2 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/helpers/Db.php(1079): yii\db\Command->execute()
#3 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/Elements.php(1179): craft\helpers\Db::upsert('{{%elements_bul...', Array, true, Array, true, Object(craft\db\Connection))
#4 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/Elements.php(3802): craft\services\Elements->trackElementInBulkOps(Object(craft\elements\Entry))
#5 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/Elements.php(1201): craft\services\Elements->craft\services\{closure}()
#6 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/Elements.php(3575): craft\services\Elements->ensureBulkOp(Object(Closure))
#7 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/Elements.php(1287): craft\services\Elements->_saveElementInternal(Object(craft\elements\Entry), false, false, NULL, Array, false, false, true)
#8 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/Entries.php(955): craft\services\Elements->saveElement(Object(craft\elements\Entry), false)
#9 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/Entries.php(836): craft\services\Entries->_ensureSingleEntry(Object(craft\models\Section), Array)
#10 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(1816): craft\services\Entries->handleChangedSection(Object(craft\events\ConfigEvent))
#11 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/ProjectConfig.php(1179): craft\console\Application->craft\base\{closure}(Object(craft\events\ConfigEvent))
#12 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
#13 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/Component.php(641): call_user_func(Array, Object(craft\events\ConfigEvent))
#14 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/models/ProjectConfigData.php(85): yii\base\Component->trigger('updateItem', Object(craft\events\ConfigEvent))
#15 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/ProjectConfig.php(564): craft\models\ProjectConfigData->commitChanges(Array, Array, 'sections.7a8e5e...', true, 'Save section \xE2\x80...', true)
#16 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/ProjectConfig.php(524): craft\services\ProjectConfig->_setInternal('sections.7a8e5e...', Array, 'Save section \xE2\x80...', true, false)
#17 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/services/Entries.php(597): craft\services\ProjectConfig->set('sections.7a8e5e...', Array, 'Save section \xE2\x80...')
#18 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/migrations/m240302_212719_solo_preview_targets.php(38): craft\services\Entries->saveSection(Object(craft\models\Section))
#19 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/db/Migration.php(50): craft\migrations\m240302_212719_solo_preview_targets->safeUp()
#20 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): craft\db\Migration->up()
#21 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/controllers/MigrateController.php(382): yii\console\controllers\BaseMigrateController->migrateUp('m240302_212719_...')
#22 [internal function]: craft\console\controllers\MigrateController->actionAll()
#23 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#24 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#25 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('all', Array)
#26 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/controllers/MigrateController.php(195): yii\console\Controller->runAction('all', Array)
#27 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/Module.php(552): craft\console\controllers\MigrateController->runAction('all', Array)
#28 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#29 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('migrate/all', Array)
#30 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/Controller.php(212): craft\console\Application->runAction('migrate/all', Array)
#31 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/Controller.php(207): yii\base\Controller->run('migrate/all', Array)
#32 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/controllers/UpController.php(60): craft\console\Controller->run('migrate/all', Array)
#33 [internal function]: craft\console\controllers\UpController->actionIndex()
#34 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#35 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#36 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('', Array)
#37 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/ControllerTrait.php(89): yii\console\Controller->runAction('', Array)
#38 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/Controller.php(216): craft\console\Controller->traitRunAction('', Array)
#39 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('', Array)
#40 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('up', Array)
#41 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('up', Array)
#42 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('up', Array)
#43 /Users/a/Sites/lucetta/craft/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest(Object(craft\console\Request))
#44 /Users/a/Sites/lucetta/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#45 /Users/a/Sites/lucetta/craft/craft(13): yii\base\Application->run()
#46 {main}
*** failed to apply m240302_212719_solo_preview_targets (time: 50.317s)


22 from 34 migrations were applied.

Migration failed. The rest of the migrations are canceled.

Steps to reproduce

  1. Following the upgrade guide, at the step php craft up fails to apply all migrations.

Expected behavior

I expect the migrations to work.

Actual behavior

Migrations fail and I restore the database to get back to Craft 4.

Craft CMS version

4.11

PHP version

8.3

Operating system and version

macOS Sequoia 15

Database type and version

MySQL 8.0.33

Image driver and version

GD 8.3.10

Installed plugins and versions

No response

@brandonkelly
Copy link
Member

Craft 5.3.5 is out with a fix for this 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants