Magento upgrade with SQL error after migrate

Magento upgrade with SQL error is a terrible thing

Today, when I do Magento upgrade and migrate for customer from Magento 1.6 to Magento 2.1.0. I receive this error . The method I use to upgrade is clone from github and using composer to upgrade (not using zip file). Below are the errors I receive after running the upgrade command.

[Zend_Db_Statement_Exception]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘4-Images’ for key ‘EAV_ATTRIBUTE_GROUP_ATTRIBUTE_SET_ID_ATTRIBUTE_GR
OUP_NAME’, query was: UPDATE `eav_attribute_group` SET `attribute_group_name` = ? WHERE (`attribute_group_id`=10)

[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘4-Images’ for key ‘EAV_ATTRIBUTE_GROUP_ATTRIBUTE_SET_ID_ATTRIBUTE_GR
OUP_NAME’

magento upgrade

After a couple of time searching and try a lot of stuff, finally I found the way to fix this issue. This issue is come from migrate tool when I migrate database from Magento 1.x to Magento 2. All you need to do to is go to table eav_attribute_group and remove row “Images” in column attribute_group_name. You can do this on SQL Query or make it easier on phpMyadmin

Then run Magento upgrade with command setup:upgrade  and the SQL error will disappear

Source: https://github.com/magento/magento2/issues/5175

Leave a Reply