1

I'm trying to migrate from Magento 1 to 2 and when I get to this part:

[2017-10-06 14:04:36][INFO][mode: data][stage: data migration][step: Map Step]: started 33% [=========>------------------] Remaining Time: 3 mins

I then get this error

[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'

Any ideas?

1
  • did you try to delete this record from that particular table ? if not then do this after take database backup then perform. Sep 11, 2019 at 16:35

4 Answers 4

2

The problem should go away if you change bulk_size to something other than 0 in your config.xml. It doesn't seem to auto-detect correctly on the customer_group table. Setting mine to 100 solved the problem for me.

To find out what table is the problem, try adding some debugging info to your src/Migration/Step/Map/Data.php file. Something like $this->logger->info("DEBUG: " . $sourceDocName ); around line 136 (in the perform() method, first thing within the first foreach loop). This should output the table the migration tool is currently working on in the console.

3
  • 1
    Great tip to add the debug line. Helped me proceed.
    – Akif
    Jun 24, 2021 at 19:43
  • You should rather tell in which method not line, the line can vary depending on the version.
    – Black
    Jul 22, 2021 at 11:41
  • Thanks @Black, I've edited the answer. Jul 23, 2021 at 14:41
0

I am getting the same error. When doing the migration with verbose mode on, I can see that the issue is with the "customer_group" table. Primary key 0 is the "NOT LOGGED IN" customer group.

That is how far I am into for now. I will let you know if I find anything else.

1
  • How do you know which table is causing the issue?
    – Fred
    Oct 9, 2017 at 8:21
0

I had the same problem.. to get past it at least temporarily, I added this to the map.xml file under source and under document_rules

 <ignore>
    <document>customer_group</document>
 </ignore>
0
<ignore>
    <document>customer_group</document>
 </ignore>

worked for me inside the map.xml (or map.xml.dist) source -> field_rules node

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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