data-migration-tool icon indicating copy to clipboard operation
data-migration-tool copied to clipboard

Integrity constraint violation: 1062 Duplicate entry 'XXX-XXX' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'

Open alejandrosantafixie opened this issue 5 years ago • 10 comments
trafficstars

Preconditions

  1. Migrating from Magento 1.9.3.10
  2. Migrating to Magento 2.3.5-p1

Steps to reproduce

  1. Run Settings migration as usual
  2. Run Data migration as usual

Expected result

  1. Migration with no errors or integrity step failing with details

Actual result

  1. Integrity constraint violation: 1062 Duplicate entry 'XX-XXX' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'

Additional notes

I have 44 attribute sets in my M1 database. This error only comes up with 2 of the (Attribute set IDs 9 and 12).

I've already checked my M1 & M2 databases and there are no duplicated entries as the error says. Also, this was recognized as a bug on a previous version of Data Migration Tool.

The suggested solution was comment/remove remove a method at Migration/Step/Eav/Data.php and add the attributes manually to the sets.

Is there a official or tested fix for this?

Note: Here is a list with some of the attribute_set_id / attribute_id combination which fails.

Integrity constraint violation: 1062 Duplicate entry '9-110' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
Integrity constraint violation: 1062 Duplicate entry '9-503' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
Integrity constraint violation: 1062 Duplicate entry '9-863' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
Integrity constraint violation: 1062 Duplicate entry '12-111' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'

(The same happen to almost all attributes assigned to attribute sets 9 and 12).

alejandrosantafixie avatar Jun 10 '20 10:06 alejandrosantafixie

Hi @alejandrosantafixie. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Jun 10 '20 10:06 m2-assistant[bot]

Hi @alejandrosantafixie! :wave: Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

m2-assistant[bot] avatar Jun 10 '20 10:06 m2-assistant[bot]

@victor-v-rad This is the same problem, and it's coming up again because data-migration-tool/src/Migration/Step/Eav/Data.php was completly rewritten in Data Migration Tool 2.3.5: https://github.com/magento/data-migration-tool/issues/201#issuecomment-361440309.

It looks like the issue is at the createProductAttributeSetStructures method

alejandrosantafixie avatar Jun 11 '20 11:06 alejandrosantafixie

I ran a migration using the same M1 database, but downgrading my M2 to v.2.3.4 and it worked.

Comparing the 2.3.4 and 2.3.5 results, I found that data-migration-tool/src/Migration/Step/Eav/Data.php file was completely rewritten and the renaming step from "Default" to "Migration_Default" for the Attribute Set contained in eav_attribute_set table were removed on the latest version of Data Migration Tool.

In this scenario, there is a very high probability to get constrains like this: Duplicate entry 'xxx-xxx' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'.

alejandrosantafixie avatar Jun 12 '20 08:06 alejandrosantafixie

Hi @alejandrosantafixie

I comitted a fix https://github.com/magento/data-migration-tool/commit/46c1d11d598daba30681f700c63718740c77ba15 for EAV step into 2.3-develop branch Please try it and see if it helps

victor-v-rad avatar Jun 12 '20 16:06 victor-v-rad

@victor-v-rad I tested the patch in Magento 2.3.5. Doesn't fix the issue :/

alejandrosantafixie avatar Jun 19 '20 12:06 alejandrosantafixie

Also having this issue.

scheMeZa avatar Jun 25 '20 20:06 scheMeZa

Met too same here SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '9-Images' for key 'EAV_ATTRIBUTE_GROUP_ATTRIBUTE_SET_ID_ATTRIBUTE_GROUP_NAME'

takeoffdigital avatar Jun 26 '20 09:06 takeoffdigital

@scheMeZa @takeoffdigital Try with Magento & Data Migration Tool 2.3.4. Then, update your Magento version to 2.3.5.

alejandrosantafixie avatar Jun 29 '20 07:06 alejandrosantafixie

FYI, I was getting this exact error for a commerce-to-commerce migration from 1.14.4.5 to 2.3.5. It was getting hung up on attribute_code rma_entity_id, despite being a completely fresh install and only having a single row for that attribute in M1.

After restoring from backup to a new fresh install and running with the latest nightly code I no longer get this error.

jasonkcarter avatar Jul 09 '20 23:07 jasonkcarter