2

I'm trying to migrate a CE 1.9.2.4 to CE 2.3.0 using the migration tool. I've managed to migrate the settings ok but when I try to migrate the data if get the following error.

[2019-03-11 14:02:16][INFO][mode: data][stage: data migration][step: Map Step]: started
7% [==>-------------------------] Remaining Time: < 1 sec
In Mysql.php line 173:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '13-1052-0' for key 'CATALOG_CATEGORY_ENTITY_INT_ENTITY_ID_ATTRIBUTE_ID_STORE_ID'                                                                             

I've seen posts about similar errors but nothing that relates to CATALOG_CATEGORY_ENTITY_INT_ENTITY_ID_ATTRIBUTE_ID_STORE_ID. I realise that there is some kind of duplicate but can't find a way to identify and fix it.

Any help is really appreciated.

2
  • 1
    Mysql errors are what they say. It is hard to debug them without database access. You indeed have a duplicate entity_id attribute_id store_id combination within catalog_category_entity_int table. There is nothing more to say really. I will explain it further in an answer Commented Mar 11, 2019 at 15:00
  • There is no black and white answer to provide here. As per the error, it tells you where to look in your database. It's just going to take time for you to run an investigation. @CompactCode has provided a good answer to help narrow down the search.
    – Craig
    Commented Mar 11, 2019 at 17:46

1 Answer 1

2

So what you have is a duplicate unique key. You can see the key is

CATALOG_CATEGORY_ENTITY_INT_ENTITY_ID_ATTRIBUTE_ID_STORE_ID

Now from this key we can know 2 things.

  1. It is about the table CATALOG_CATEGORY_ENTITY_INT

  2. There is a duplicate combination. So one of the rows its entity_id , attribute_id AND store_id matches that of another row.

You will need to search for such a duplicate.

For MYSQL this 'unique combination' is stored within a non-visible 'CATALOG_CATEGORY_ENTITY_INT_ENTITY_ID_ATTRIBUTE_ID_STORE_ID' key and it finds the duplicate in that key.

We often perform migrations for our customers and see that Magento 1 validation for such keys is sometimes not set. But Magento 2 does. So that is why you have that error. That or the SQL import defines it twice which is possible.

4
  • Thanks for your detailed reply. Could you share the best way to locate the duplicate entry and edit or delete it please?
    – NudeWeb
    Commented Mar 11, 2019 at 15:13
  • @CompactCode, your a better person than me. Migrating a single site from M1 to M2 was enough for me. I'm still finding "ghosts" in the database 3 months later :)
    – Craig
    Commented Mar 11, 2019 at 17:48
  • @NudeWeb . Well you can locate them by doing something similar to this stackoverflow.com/questions/1786533/… Commented Mar 12, 2019 at 1:39
  • @Craig Migrations are a pain in the *** for large stores but doable once you know the most common errors Commented Mar 12, 2019 at 1:40

Your Answer

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

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