10

Anyone having this issue?

data migration > EAV Step

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-Migration_Default' for key 'EAV_ATTRIBUTE_SET_ENTITY_TYPE_ID_ATTRIBUTE_SET_NAME'

  • Have you found any solution for this? – Gaurav Agrawal Sep 15 '17 at 7:34
4

This error occurs when the migration tool fails to transfer data (e.g. due to integrity violations) without rolling back, and is ran again. It attempts to create "Migration_Default" attribute set and fails, because it already is present in the database.

What you have to do is to:

1) Restore your Magento 2.0 database from a copy that you (hopefully) made before running the migration tool.

2) Run the migration tool again and check for the first error that it fails on. In my case it was:

[PDOException]                                                                                                              
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'home-1' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID'

3) Fix the problem (I had to manually remove a row in the DB).

Repeat the steps until you've cleared all errors and see the sweet sounding message:

Migration completed
  • I am facing same issue, Where i can change this value? – Purushotam Sharma Aug 11 '16 at 12:16
  • 1
    Which value? How to remove a DB row that's causing an integrity constraint violation? Look at the index name. In my case it was "URL_REWRITE_REQUEST_PATH_STORE_ID". The first part of it is the name of the table with the offending record. In my case it was url_rewrite (or more precisely my-prefix_url_rewrite). REQUEST_PATH and STORE_ID are two columns that when put together have to be unique. In my case the migration tool was trying to insert two records with "home" under request_path and 1 under store_id. I had to remove the first one. – Mateusz Aug 12 '16 at 15:31
  • @Mateusz, if we use command, -r it will not reset the db and start from beginning? every time restoring db is too time taking processs – jafar pinjar Apr 16 at 10:10
1

In my case: It happened to me and I had to import a backup of my magento 2 database before reloading migration.

At your case: Maybe you had to reload data migration a second time.

  • hi @Kevin, reset command will not reset the settings? it will not start from beginning? every time need to reset the db? – jafar pinjar Apr 16 at 10:08
1

To fix this issue,

  1. First you need to check for already migrated attribute sets.
  2. Then delete those attribute sets except the default one.

You can do that through your SQL querying application or interface.

DELETE FROM eav_attribute_set WHERE attribute_set_name != 'Default';
1

I found this solution that solved this issue for me https://github.com/magento/data-migration-tool/issues/235#issuecomment-321923437

Solution is to rename all values containing the name "Default" in "attribute_value_name" field of eav_attribute_set table to "Default_x" in the Magento 1 database and run the migration from scratch.

In my case, there were 9 records with name "Default". So I renamed them to Default_1 to Default_9 and it worked perfectly!

0

Data-Migration-Tool does not receive data from the source in utf8.
Here is a simple solution to this problem:

Edit: vendor/magento/data-migration-tool/src/Migration/ResourceModel/Adapter/Mysql.php

public function __construct(
    \Magento\Framework\DB\Adapter\Pdo\MysqlFactory $adapterFactory,
    \Magento\Framework\DB\Ddl\TriggerFactory $triggerFactory,
    array $config
) {
    $config['initStatements'] = 'SET NAMES utf8'; // +
    $configData['config'] = $config;
    $this->resourceAdapter = $adapterFactory->create($configData);
    $this->setForeignKeyChecks(0);
    $this->triggerFactory = $triggerFactory;
}

GitHub

  • Can you explain why this would make a difference on duplicating a primary key? – domdambrogia Nov 20 '18 at 0:31
0

In my experience, there is sample data installed. So, i have done the following steps.

  1. I dropped the database
  2. Then reinstall magento 2 again without sample data.

Then, I can migrate.

0

Fixed my issue with following sql:

Integrity constraint violation: 1062 Duplicate entry ‘4-Images’ for key – Magento 2

delete from eav_attribute_group WHERE attribute_group_name = 'Images';

So try something

delete from eav_attribute_group WHERE attribute_group_name = 'Home';
0

Double check with your migrating Database Magento 2. Sometimes We didn't change the database name in the data migrating tool.

Reinstall fresh Magento instance and correctly add database name in data migrating tool

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.