step 7 duplicate entry issue in delta migration

Hello Team, 

I am facing issue of 
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘1919403’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote` (`store_id`, `is_active`, `is_virtual`, `is_multi_shipping`, `items_count`, `items_qty`, `orig_order_id`, `store_to_base_rate`,  …
I want to know that if i am running migration with --mode=update then why this kind of error appear ?  and what is the correct solution to remove all duplicate entries ?

if i delete dupicate record manually and start migration again then its start from initial so its take more time. 
 
Thanks

2 answers

Profile photo of Mall Staff 136830.00 $tone May 16, 2020
Public

Hi there,

 1062 Duplicate entry ‘1919403’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote` (`store_id`, `is_active`, `is_virtual`, `is_multi_shipping`, `items_count`, `items_qty`, `orig_order_id`, `store_to_base_rate`,  …
I want to know that if i am running migration with --mode=update then why this kind of error appear ?  and what is the correct solution to remove all duplicate entries ?

That was because you checked the ‘KEEP ORIGINAL IDs’ setting in step #7 while your M2 database had some newly added sales data after the first migration.

To solve that issue, you have to delete all new sales data added in your M2 (which weren’t migrated by our migration tool) by running the following SQL queriess in your M2 database:

Delete From salesrule Where rule_id NOT IN (Select m2_id From ub_migrate_map_step_7 where entity_name = 'salesrule');
Delete From quote Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_quote where entity_name = 'sales_flat_quote' OR entity_name = 'sales_flat_quote_active');
Delete From quote_item Where item_id NOT IN (Select m2_id From ub_migrate_map_step_7_quote_item where entity_name = 'sales_flat_quote_item');
Delete From quote_address Where address_id NOT IN (Select m2_id From ub_migrate_map_step_7_quote_address where entity_name = 'sales_flat_quote_address');
Delete From sales_order Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_order where entity_name = 'sales_flat_order');
Delete From sales_order_item Where item_id NOT IN (Select m2_id From ub_migrate_map_step_7_order_item where entity_name = 'sales_flat_order_item');
Delete From sales_order_address Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_order_address where entity_name = 'sales_flat_order_address');

+ Once done, you can continue with the data migration in step #7 as normal.
 
PS. Since our team is off during the weekend, our apology for a certain delay when replying to you. We will follow up with you through out the weekend though. 

Regards,
Mall.

#2

Please login or Register to Submit Answer

Written By

Comments