Closed pseudoclass closed 4 years ago
Hi @pseudoclass,
Could you please confirm whether you're able to run ./craft project-config/rebuild
without errors, after updating Craft but without updating Field Labels?
Hello @ttempleton, Thank you for the quick reply :)
Confirmed. If we update Craft first and then update Field Labels to v1.3.1 the migration and subsequent project-config apply or rebuild it do work. My guess is trying to run the Craft update and the Field Labels update at the same time is what is causing the problem.
@ttempleton , looks like I spoke too soon :(
When attempting to update Field Labels after updating Craft on our server environment we are now getting this error:
Exception: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "gqlschemas_name_unq_idx"
DETAIL: Key (name)=(Public Schema) already exists.
The SQL being executed was: INSERT INTO "gqlschemas" ("uid", "name", "isPublic", "scope", "dateCreated", "dateUpdated") VALUES ('3567d838-3d9c-4dcb-a985-e838788857fb', 'Public Schema', TRUE, '[]', '2020-09-01 16:23:25', '2020-09-01 16:23:25') RETURNING "id" (/home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/db/Schema.php:677)
#0 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/db/Command.php(1298): yii\db\Schema->convertException(Object(PDOException), 'INSERT INTO "gq...')
#1 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/db/Command.php(1159): yii\db\Command->internalExecute('INSERT INTO "gq...')
#2 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/db/Command.php(415): yii\db\Command->queryInternal('fetch', NULL)
#3 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/db/pgsql/Schema.php(633): yii\db\Command->queryOne()
#4 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/db/ActiveRecord.php(600): yii\db\pgsql\Schema->insert('{{%gqlschemas}}', Array)
#5 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/db/ActiveRecord.php(566): yii\db\ActiveRecord->insertInternal(NULL)
#6 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/db/BaseActiveRecord.php(678): yii\db\ActiveRecord->insert(false, NULL)
#7 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/Gql.php(962): yii\db\BaseActiveRecord->save(false)
#8 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/ProjectConfig.php(1089): craft\services\Gql->handleChangedSchema(Object(craft\events\ConfigEvent))
#9 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
#10 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Array, Object(craft\events\ConfigEvent))
#11 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/ProjectConfig.php(664): yii\base\Component->trigger('addItem', Object(craft\events\ConfigEvent))
#12 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/helpers/ProjectConfig.php(139): craft\services\ProjectConfig->processConfigChanges('graphql.schemas...')
#13 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/Gql.php(864): craft\helpers\ProjectConfig::ensureAllGqlSchemasProcessed()
#14 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/ProjectConfig.php(1089): craft\services\Gql->handleChangedPublicToken(Object(craft\events\ConfigEvent))
#15 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
#16 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Array, Object(craft\events\ConfigEvent))
#17 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/ProjectConfig.php(667): yii\base\Component->trigger('updateItem', Object(craft\events\ConfigEvent))
#18 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/ProjectConfig.php(475): craft\services\ProjectConfig->processConfigChanges('graphql.publicT...', true, '')
#19 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/Gql.php(837): craft\services\ProjectConfig->set('graphql.publicT...', Array)
#20 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/Gql.php(807): craft\services\Gql->saveToken(Object(craft\models\GqlToken))
#21 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/ProjectConfig.php(1995): craft\services\Gql->getPublicToken()
#22 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/ProjectConfig.php(1143): craft\services\ProjectConfig->_getGqlData()
#23 /home/forge/dev.facadetectonics.org/vendor/spicyweb/craft-fieldlabels/src/migrations/m200812_104254_craft_3_5_field_layout_transition_part_2.php(86): craft\services\ProjectConfig->rebuild()
#24 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/db/Migration.php(52): spicyweb\fieldlabels\migrations\m200812_104254_craft_3_5_field_layout_transition_part_2->safeUp()
#25 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/db/MigrationManager.php(232): craft\db\Migration->up(true)
#26 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/db/MigrationManager.php(148): craft\db\MigrationManager->migrateUp(Object(spicyweb\fieldlabels\migrations\m200812_104254_craft_3_5_field_layout_transition_part_2))
#27 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/Updates.php(227): craft\db\MigrationManager->up()
#28 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/console/controllers/MigrateController.php(328): craft\services\Updates->runMigrations(Array)
#29 [internal function]: craft\console\controllers\MigrateController->actionAll()
#30 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#31 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#32 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/console/Controller.php(181): yii\base\Controller->runAction('all', Array)
#33 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('all', Array)
#34 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#35 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application->runAction('migrate/all', Array)
#36 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('migrate/all', Array)
#37 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#38 /home/forge/dev.facadetectonics.org/craft(22): yii\base\Application->run()
#39 {main}
Exception 'craft\errors\MigrateException' with message 'An error occurred while migrating Field Labels.'
in /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/services/Updates.php:235
Stack trace:
#0 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/console/controllers/MigrateController.php(328): craft\services\Updates->runMigrations(Array)
#1 [internal function]: craft\console\controllers\MigrateController->actionAll()
#2 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#4 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/console/Controller.php(181): yii\base\Controller->runAction('all', Array)
#5 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('all', Array)
#6 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#7 /home/forge/dev.facadetectonics.org/vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application->runAction('migrate/all', Array)
#8 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('migrate/all', Array)
#9 /home/forge/dev.facadetectonics.org/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#10 /home/forge/dev.facadetectonics.org/craft(22): yii\base\Application->run()
#11 {main}
I think I'll need to rewrite the migrations so they don't need to run the rebuild. I'll aim to have that done in the next few days.
Field Labels 1.3.1.1 has just been released, including the rewrite of the migrations to avoid using a project config rebuild, instead updating the project config directly where possible. In some cases, Field Labels might not be able to save the label data to the project config (e.g. if a field layout hasn't yet been updated to the new format in the project config). In these cases, Field Labels will still update the field layouts in the database, but will log a warning to notify that a project config rebuild will need to be manually run.
Description
When trying to update to Craft 3.5.4 and Field Labels 1.3.1 we are getting a migration error:
Steps to reproduce
Other information