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

Integrity Constraint Violation error in 3.4 beta #5357

Open
JayBox325 opened this issue Dec 18, 2019 · 5 comments
Open

Integrity Constraint Violation error in 3.4 beta #5357

JayBox325 opened this issue Dec 18, 2019 · 5 comments

Comments

@JayBox325
Copy link
Contributor

@JayBox325 JayBox325 commented Dec 18, 2019

Description

I've just dragged an old field into an old entry's field setup in the Admin and it's thrown this error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'shortDesc-global' for key 'fields_handle_context_unq_idx' in /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/Command.php:1290
Stack trace:
#0 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/Command.php(1290): PDOStatement->execute()
#1 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command->internalExecute('INSERT INTO `fi...')
#2 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/Schema.php(432): yii\db\Command->execute()
#3 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/ActiveRecord.php(600): yii\db\Schema->insert('{{%fields}}', Array)
#4 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/ActiveRecord.php(566): yii\db\ActiveRecord->insertInternal(NULL)
#5 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/BaseActiveRecord.php(678): yii\db\ActiveRecord->insert(false, NULL)
#6 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/Fields.php(1545): yii\db\BaseActiveRecord->save(false)
#7 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/Fields.php(836): craft\services\Fields->applyFieldSave('e2a31a80-4266-4...', Array, 'global')
#8 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(945): craft\services\Fields->handleChangedField(Object(craft\events\ConfigEvent))
#9 [internal function]: craft\services\ProjectConfig->craft\services\{closure}(Object(craft\events\ConfigEvent))
#10 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(craft\events\ConfigEvent))
#11 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(584): yii\base\Component->trigger('addItem', Object(craft\events\ConfigEvent))
#12 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/helpers/ProjectConfig.php(64): craft\services\ProjectConfig->processConfigChanges('fields.e2a31a80...')
#13 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/Sections.php(1184): craft\helpers\ProjectConfig::ensureAllFieldsProcessed()
#14 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(945): craft\services\Sections->handleChangedEntryType(Object(craft\events\ConfigEvent))
#15 [internal function]: craft\services\ProjectConfig->craft\services\{closure}(Object(craft\events\ConfigEvent))
#16 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(craft\events\ConfigEvent))
#17 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(592): yii\base\Component->trigger('updateItem', Object(craft\events\ConfigEvent))
#18 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(427): craft\services\ProjectConfig->processConfigChanges('sections.4e9673...', true, 'Save entry type...')
#19 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/Sections.php(1163): craft\services\ProjectConfig->set('sections.4e9673...', Array, 'Save entry type...')
#20 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/controllers/SectionsController.php(374): craft\services\Sections->saveEntryType(Object(craft\models\EntryType))
#21 [internal function]: craft\controllers\SectionsController->actionSaveEntryType()
#22 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#23 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#24 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/web/Controller.php(187): yii\base\Controller->runAction('save-entry-type', Array)
#25 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-entry-type', Array)
#26 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction('sections/save-e...', Array)
#27 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/web/Application.php(565): craft\web\Application->runAction('sections/save-e...', Array)
#28 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#29 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#30 /Users/jaycollett/Sites/jaycollett/mama-codes/build/public/index.php(21): yii\base\Application->run()
#31 {main}

Next yii\db\IntegrityException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'shortDesc-global' for key 'fields_handle_context_unq_idx'
The SQL being executed was: INSERT INTO `fields` (`uid`, `groupId`, `name`, `handle`, `context`, `instructions`, `searchable`, `translationMethod`, `translationKeyFormat`, `type`, `settings`, `dateCreated`, `dateUpdated`) VALUES ('e2a31a80-4266-4c5f-a72d-cf3990e795cb', 5, 'Short description', 'shortDesc', 'global', '', 1, 'none', NULL, 'craft\\fields\\PlainText', '{\"byteLimit\":null,\"charLimit\":null,\"code\":\"\",\"columnType\":null,\"initialRows\":\"4\",\"multiline\":\"\",\"placeholder\":\"\"}', '2019-12-18 15:42:38', '2019-12-18 15:42:38') in /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/Schema.php:674
Stack trace:
#0 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/Command.php(1295): yii\db\Schema->convertException(Object(PDOException), 'INSERT INTO `fi...')
#1 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command->internalExecute('INSERT INTO `fi...')
#2 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/Schema.php(432): yii\db\Command->execute()
#3 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/ActiveRecord.php(600): yii\db\Schema->insert('{{%fields}}', Array)
#4 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/ActiveRecord.php(566): yii\db\ActiveRecord->insertInternal(NULL)
#5 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/db/BaseActiveRecord.php(678): yii\db\ActiveRecord->insert(false, NULL)
#6 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/Fields.php(1545): yii\db\BaseActiveRecord->save(false)
#7 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/Fields.php(836): craft\services\Fields->applyFieldSave('e2a31a80-4266-4...', Array, 'global')
#8 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(945): craft\services\Fields->handleChangedField(Object(craft\events\ConfigEvent))
#9 [internal function]: craft\services\ProjectConfig->craft\services\{closure}(Object(craft\events\ConfigEvent))
#10 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(craft\events\ConfigEvent))
#11 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(584): yii\base\Component->trigger('addItem', Object(craft\events\ConfigEvent))
#12 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/helpers/ProjectConfig.php(64): craft\services\ProjectConfig->processConfigChanges('fields.e2a31a80...')
#13 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/Sections.php(1184): craft\helpers\ProjectConfig::ensureAllFieldsProcessed()
#14 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(945): craft\services\Sections->handleChangedEntryType(Object(craft\events\ConfigEvent))
#15 [internal function]: craft\services\ProjectConfig->craft\services\{closure}(Object(craft\events\ConfigEvent))
#16 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(craft\events\ConfigEvent))
#17 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(592): yii\base\Component->trigger('updateItem', Object(craft\events\ConfigEvent))
#18 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/ProjectConfig.php(427): craft\services\ProjectConfig->processConfigChanges('sections.4e9673...', true, 'Save entry type...')
#19 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/services/Sections.php(1163): craft\services\ProjectConfig->set('sections.4e9673...', Array, 'Save entry type...')
#20 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/controllers/SectionsController.php(374): craft\services\Sections->saveEntryType(Object(craft\models\EntryType))
#21 [internal function]: craft\controllers\SectionsController->actionSaveEntryType()
#22 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#23 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#24 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/web/Controller.php(187): yii\base\Controller->runAction('save-entry-type', Array)
#25 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-entry-type', Array)
#26 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction('sections/save-e...', Array)
#27 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/web/Application.php(565): craft\web\Application->runAction('sections/save-e...', Array)
#28 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#29 /Users/jaycollett/Sites/jaycollett/mama-codes/build/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#30 /Users/jaycollett/Sites/jaycollett/mama-codes/build/public/index.php(21): yii\base\Application->run()
#31 {main}
Additional Information:
Array
(
    [0] => 23000
    [1] => 1062
    [2] => Duplicate entry 'shortDesc-global' for key 'fields_handle_context_unq_idx'
)

It's mentioning the shortDesc field which is odd, because that field isn't one that I was adjusting.

I can provide more details if required.

Steps to reproduce

  1. Not sure tbh but I was dragging a field into an entry field config.

Additional info

  • Craft version: 3.4.0-beta.4
@brandonkelly

This comment has been minimized.

Copy link
Member

@brandonkelly brandonkelly commented Dec 18, 2019

Do you have a recent DB backup that you can reproduce this with? If so can you please send that over to support@craftcms.com, along with your composer.json and composer.lock files?

@JayBox325

This comment has been minimized.

Copy link
Contributor Author

@JayBox325 JayBox325 commented Dec 18, 2019

Sent. Thanks, Brandon! 🙌🏻

@JayBox325

This comment has been minimized.

Copy link
Contributor Author

@JayBox325 JayBox325 commented Dec 18, 2019

@brandonkelly just heads up that this error is happening for all channel and global field config processes not just one instance.

@volpevalerio

This comment has been minimized.

Copy link

@volpevalerio volpevalerio commented Jan 9, 2020

I'm having the same problems, is there a workaround?

@brandonkelly

This comment has been minimized.

Copy link
Member

@brandonkelly brandonkelly commented Jan 9, 2020

@volpevalerio we unfortunately didn’t get anywhere with @JayBox325 on this, because we weren’t able to reproduce the error with his DB & Composer files. We can try again with you though, if you can send those files into support@craftcms.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.