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: 1062 Duplicate entry 'fieldTitle-global' for key 'fields_handle_context_unq_idx' #4360

Open
p1729 opened this issue Jun 5, 2019 · 2 comments

Comments

Projects
None yet
4 participants
@p1729
Copy link

commented Jun 5, 2019

Description

Integrity constraint violation: 1062 Duplicate entry 'fieldTitle-global' for key 'fields_handle_context_unq_idx'

Steps to reproduce

  1. Create a field with a handle, now delete the field and create the another handle with same name (to get different UID for the field but the fieldHandle name should be same)
  2. Now propagate these changes through project.yaml on another instance
  3. If insertion is happening before deletion you will get the constraint violation error

Additional info

  • Craft version: 3.1.28
  • PHP version: 7
  • Database driver & version: MySQL 5.6
  • Plugins & versions:
@tim-pixeldeluxe

This comment has been minimized.

Copy link
Contributor

commented Jun 5, 2019

Also getting a similar error, it might be caused by this bug too. The field that is causing problems on my end seems to be the sku.

This might help trying to investigate this bug:
https://pastebin.com/56Qxvqqs

@andris-sevcenko

This comment has been minimized.

Copy link
Member

commented Jun 6, 2019

@tim-pixeldeluxe your issue is not related to this at all. It's related to importing elements and doesn't seem like it has to do anything with project config. Please open a separate issue for this with more information what you're doing and also more information on how does the ProductImporter work, which, I assume, seems to be custom :)

@p1729 I'm not able to reproduce this issue.

If insertion is happening before deletion you will get the constraint violation error

Which is exactly why we're parsing the changes in the order deleted>changed>added (https://github.com/craftcms/cms/blob/develop/src/services/ProjectConfig.php#L940-L959), so that makes it curious as to why this is happening for you. Can you share a stack trace?

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