I'm currently in the process of migration a Magento 1.7.0.1 project to Magento 2.2.2.
During Data migration I get this error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '21-152' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'
My understanding is that there are 2+ duplicate entries 21-152
in the eav_entity_attribute
table for columns attribute_set_id
and attribute_id
– so I thought to just delete the duplicate.
But there is no duplicate entry with that value in the source database…in fact, there is no such value in that table (in any column).
While in the destination database, this table is completely empty.
So I'm really not sure what the problem is or how to fix it…
Does anyone know what Duplicate entry 21-152
means exactly?
Or if someone could suggest an approach how to handle this issue?
Best Answer
Seems that the entry
21-152
referencedattribute_set_id = 21
andattribute_id = 152
.These IDs didn't exist in the source or destination databases, but during migration, the default attribute set of products in M2 received the id 21.
The problem was actually caused by the changed
Default
attribute set name in my M2 instance (I changed it to something other thanDefault
).Changing the name back to
Default
fixed this issue for me.Maybe this will help others...
Several advice for migrating:
Always backup your M2 database during migration, so you can restore it if the migration fails. And always migrate with a clean DB (without previous attempts to migrate).
Remove all custom attribute sets and custom attributes from M2 if they already exist in M1.