magento / data-migration-tool

Magento Data Migration Tool
https://devdocs.magento.com/guides/v2.3/migration/bk-migration-guide.html
Open Software License 3.0
334 stars 200 forks source link

Integrity constraint violation error on Map migration setp #811

Open Rajat9620 opened 4 years ago

Rajat9620 commented 4 years ago

Hello Support,

I am doing data migration from Magento 1.9.4 to Magento 2.3.3. Setting migration is working fine but I am getting error on data migration (Map Step). Error in mentioned below.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '770p h3svhdpkhqjoal0h55eso4' for key 'PRIMARY'

I have checked the migrtaion log but still not able to find the issue. @victor-v-rad @victor-ruiz Please check once and help me to solve such issue. Magento 1 version: 1.9.4.0 Php for Magento 1: 5.6 Magento 2 version: 2.3.3 Php version for magento 2 is 7.1 erreo screenshot: https://prnt.sc/s8oisw

Thanks

Rajat9620 commented 4 years ago

When I execute data migration command using -vvv option then I am getting following error https://prnt.sc/s8os9o

iphigenie commented 4 years ago

These can happen either because of a previous failed run that didn't clean after itself, or some issues in the old site that happened through things like modules that might add or delete things without keeping consistency.

The original error should be followed by a bit more so you can guess which table it is happening in

The second error is at the the inventory step integrity phase so you want to look at what is happening in Migration/Step/Inventory/Integrity.php Do you perhaps have modules in your source site that extend inventory?£ Are the inventory tables on your new site clean or is there stuff in there from some testing?

Note that depending on the scenario it's quite possible you could simply skip the inventory migration step as it is pretty easy to upload a stock update file at the point of go live.

Rajat9620 commented 4 years ago

sorry, not clear. Can you please elaborate?

On Fri, 1 May 2020 at 8:35 PM, Joelle Nebbe-Mornod notifications@github.com wrote:

These can happen either because of a previous failed run that didn't clean after itself, or some issues in the old site that happened through things like modules that might add or delete things without keeping consistency.

The original error should be followed by a bit more so you can guess which table it is happening in

The second error is at the the inventory step integrity phase so you want to look at what is happening in Migration/Step/Inventory/Integrity.php Do you perhaps have modules in your source site that extend inventory?

Note that depending on the scenario it's quite possible you could simply skip the inventory migration step as it is pretty easy to upload a stock update file at the point of go live.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/magento/data-migration-tool/issues/811#issuecomment-622424447, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGBKTLRQ4KHZSHJ5PJLHPTTRPLQJ3ANCNFSM4MVTSOPQ .

iphigenie commented 4 years ago

without more information I am guessing

The migration tool takes a few rounds of trial and error... figure out one issue, revert to clean, run again, next issue.

The error warns of a duplicate in a key, which means it is trying to insert something already in the target database. This should not happen. So either you have a duplicate in your source database (not impossible, happened to me on a website with sloppy third party extensions) but more likely, there are left traces behind from a previous run of the migration.

If there are traces left from a previous run you have to clean the target tables back (or revert your target to a clean starting point) before you can run the tool again.

If there are no traces then you have some duplication issue in your source site that you need to find.

Alas the error you quote in your first message is very cryptic and it gives no clue of what table this is, though it might have been in the more complete log

The screenshot from the next run that you shared suggests the problem is around the inventory tables so that's where you need to look for - especially if "770p" doesnt give you a hint

Good luck

Rajat9620 commented 4 years ago

Hello Joelle,

Thanks for your reply. Yes, I am running tool on fresh magento with no back traces. yes from the error I is not possible to get the issue. But still can you suggest me where or which table I need to check for the duplicate and how?

Please let me know asap.

Thanks

On Sat, 2 May 2020 at 3:14 AM, Joelle Nebbe-Mornod notifications@github.com wrote:

without more information I am guessing

The migration tool takes a few rounds of trial and error... figure out one issue, revert to clean, run again, next issue.

The error warns of a duplicate in a key, which means it is trying to insert something already in the target database. This should not happen. So either you have a duplicate in your source database (not impossible, happened to me on a website with sloppy third party extensions) but more likely, there are left traces behind from a previous run of the migration.

If there are traces left from a previous run you have to clean the target tables back (or revert your target to a clean starting point) before you can run the tool again.

If there are no traces then you have some duplication issue in your source site that you need to find.

Alas the error you quote in your first message is very cryptic and it gives no clue of what table this is, though it might have been in the more complete log

The screenshot from the next run that you shared suggests the problem is around the inventory tables so that's where you need to look for - especially if "770p" doesnt give you a hint

Good luck

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/magento/data-migration-tool/issues/811#issuecomment-622580616, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGBKTLUASRY54HY2ZU54MILRPM7EBANCNFSM4MVTSOPQ .

iphigenie commented 4 years ago

Sorry there just isnt enough information to be able to help - hopefully the data key that is duplicated "770p h3svhdpkhqjoal0h55eso4" gives you a hint what type of content it can come from. Otherwise you might want to do a database dump and grep through it to find that data... Then you know what to migrate or clean up or not migrate

ajithkumar-maragathavel commented 3 years ago

@Rajat9620 Any guess you got on this issue? I am facing the same the issue.