Integrity constraint violation: 1062 Duplicate entry 'XXX-XXX' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
문제
Preconditions
- Migrating from Magento 1.9.3.10
- Migrating to Magento 2.3.5-p1 using Data Migration Tool
Steps to reproduce
- Run Settings migration as usual
- Run Data migration as usual
Expected result
- Migration with no errors or integrity step failing with details
Actual result
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 those (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 / tested fix for this or somebody knows what it means? (Again, there are no duplicated entries)
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).
해결책
This is a bug of Data Migration Tool 2.3.5
.
It worked using the same M1 database, but downgrading my M2 to version 2.3.4
.
Comparing the 2.3.4
and 2.3.5
results, I found that the file Migration/Step/Eav/Data.php
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'.
Here is a patch for DMT 2.3.5 to fix this issue: https://github.com/magento/data-migration-tool/commit/46c1d11d598daba30681f700c63718740c77ba15
다른 팁
You need to make empty all below tables: eav_attribute_set, eav_entity_attribute, eav_attribute_group and run the migration process again.