CDbCommand failed to execute the SQL statement

Hi Team -- I’ve read the other questions on here but Can’t find the answer.
Working on my localhost, I migrated all data from my Magento1 Database (all went fine)
Then I dropped the original database and imported the latest Magento1 Database from my live server.
After that, I performed Delta Migration and I got the following error on step 7 Migration Sales:
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14299’ for key ‘PRIMARY’
I used ‘Keep Original ID’s’ for all migration steps.
Could you advise me please?
Thank you
Andy

3 answers

Profile photo of Mall Staff 184060.00 $tone January 7, 2020
Public

Hi Andy,

1062 Duplicate entry ‘14299’ for key ‘PRIMARY’
I used ‘Keep Original ID’s’ for all migration steps.

That issue occurred because you checked ‘KEEP ORIGINAL IDs’ setting in step #7 while your M2 has new sales data added after the first migration.

Please enable the debug mode in our migration tool following these steps:

+ Open the php file at: pub/ub-tool/index.php
and find the code line:

#defined('YII_DEBUG') or define('YII_DEBUG', true);

and replace it with:

defined('YII_DEBUG') or define('YII_DEBUG', true);

+ Once done, run data migration in step #7 by running the CLI command:
php -f bin/ubdatamigration run --step=7;

And let me know the details of the duplicated error message you see. I will check further and get back to you then.
 
Regards,
Mall.
 

#1
Profile photo of coir7e@e9537 1150.00 $tone January 7, 2020
Public

Thank you for getting back --
I had already reset the Migration Sales (step 7), unchecked the ‘Keep Original ID’s’ and then run it again. As it’s still running I’m not sure if it will work or not.
If it errors again, I will set the debug in action.
So to clarify things.
I should have done the initial migration using KEEP ORIGINAL IDs and for all Delta migrations, do not use KEEP ORIGINAL IDs ?
Thank you
Andy
 

#2
Profile photo of Mall Staff 184060.00 $tone January 8, 2020
Public

Hi Andy,

I should have done the initial migration using KEEP ORIGINAL IDs and for all Delta migrations, do not use KEEP ORIGINAL IDs ?

No, you can’t update the migration settings in the delta migration mode.

Regards,
Mall.

#3

Please login or Register to Submit Answer

Written By

Comments