Closed mdunbavan closed 4 years ago
TL;DR For anyone else experiencing this issue the quick fix is to execute delete from [prefix]info where id > 1
against your database. This has worked for me thus far without breaking anything but obviously do a database backup first.
I'm seeing this a lot recently too. It seems to be caused by the activation of maintenance mode:
[-][-][-][error][yii\db\IntegrityException] PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY' in /var/www/html/vendor/yiisoft/yii2/db/Command.php:1290
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1290): PDOStatement->execute()
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command->internalExecute('UPDATE `craft_i...')
#2 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(716): yii\db\Command->execute()
#3 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1421): craft\web\Application->saveInfo(Object(craft\models\Info))
#4 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(554): craft\web\Application->_setMaintenanceMode(true)
#5 /var/www/html/vendor/craftcms/cms/src/controllers/UpdaterController.php(309): craft\web\Application->enableMaintenanceMode()
#6 /var/www/html/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(304): craft\controllers\UpdaterController->initialState(false)
#7 /var/www/html/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(106): craft\controllers\BaseUpdaterController->realInitialState()
#8 [internal function]: craft\controllers\BaseUpdaterController->actionIndex()
An update to the info
table is being applied to all rows and the update contains a specific id:
But I currently have 5 rows in my info
table so it craps out.
I can send over a dump of an example info
table that's causing the problem if that helps.
But I currently have 5 rows in my
info
table so it craps out.
Well that’s the real issue here – not sure how that would have happened. I’ve just made a change that will prevent this from happening. I am a little worried that it will lead to issues for anyone with multiple info
rows in the first place though, since there’s no way to know for sure which of those rows Craft will use from request to request, so I have made it on the 3.4 branch.
I suppose it would be good if there was a check or something that flagged an issue beforehand? Like a warning or something as a prompt because it is too late to get that info when you've already completed the migration. Is there anything that checks it with project config sync that could help at all?
There is a check, which is why I’m a little stumped.
FWIW I have a row which looks normal with id
1 and the rest of the rows look like this:
(2,'3.2.10','3.2.16',0,'','','000000000000','2019-09-03 11:02:39','2019-09-03 11:02:39','0e101e0f-3109-4a95-a08f-4480b59af167'),
(3,'3.2.10','3.2.16',0,'','','000000000000','2019-10-31 16:06:19','2019-10-31 16:06:19','520ee405-8269-4025-97eb-facca51f15d6'),
(4,'3.2.10','3.2.16',0,'','','000000000000','2019-10-31 22:08:54','2019-10-31 22:08:54','a91d7ac9-2113-4374-9030-5736f03e3116'),
(5,'3.2.10','3.2.16',0,'','','000000000000','2019-11-10 18:26:18','2019-11-10 18:26:18','a8edd925-1608-42b0-8510-843b37e6858e');
Description
I had a site that I was working on that was running on a staging server. I had updated composer packages on the site and I had also synced project config. I then went into settings and sites to make sure the url for the main site was correct. Once I changed it I hit Save.
Immediately after that I hit an error which gave me this:
I had a chat with fellow devs on Discord and one user had the dame issues from time to time.
Steps to reproduce
composer install
orcomposer update
to get dependancies setup and the site working as expected on the staging server.Additional info