This is first time we tried delta migration for sales and we are facing the below issues
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘12866209’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `sales_shipment_comment` (`is_visible_on_front`, `entity_id`, `parent_id`, `is_customer_notified`, `comment`, `created_at`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5)
Same kind of error we got on other 2 tables also
sales_shipment_track
quote_payment
-
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '14965663' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
3 answers
Hi there,
I am sorry for my late reply as I’ve just been back to work from our weekend.
1062 Duplicate entry ‘12866209’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `sales_shipment_comment` (`is_visible_on_front`, `entity_id`,
…
1062 Duplicate entry ‘14965663’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`,
That was because you checked the ‘KEEP ORIGINAL IDs’ setting in step #7 of our migration tool, then you created some testing data on sales data section after the first migration. To continue with the delta migration in step #7, you need to delete the testing data I mentioned. You can try with steps below:
+ Run the following SQL in your M2 database:
Delete From sales_shipment_comment Where entity_id = 12866209;
Delete From quote_payment Where payment_id = 14965663;
Regarding this issue:
Same kind of error we got on other 2 tables also
sales_shipment_track
Please provide me further details of error message on that, I will provide you the SQL to clean the data record which raised the duplicated issue. And then, you can continue in step #7.
Regards,
Mall.
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14955185’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14955185’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14971199’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14971251’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14978517’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14982137’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14984805’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14990345’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘14991857’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote_payment` (`quote_id`, `cc_exp_year`, `cc_ss_start_month`, `cc_ss_start_year`, `payment_id`, `created_at`, `updated_at`, `method`, `cc_type`, `cc_exp_month`, `additional_information`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
I don’t know why but we have got so many on quote_payment.
Its like every 2 hours i need to delete and rerun again.
Can you please explain why and how to resolve , so I don’t have to monitor.
And also what table does it write sales rule .
As I see `salesrule` table has only 882 records, it should not have taken 2 days atleast
Hi there,
I don’t know why but we have got so many on quote_payment.
When Keep Original IDs is enabled, it’s required that your M2 instance must be fresh. Your M2 instance has the newly added sample or testing data in place after the first migration, thus it caused the issue.
Can you please explain why and how to resolve , so I don’t have to monitor.
We’re afraid you have to review on case by case basis as follows:
You can try to run the following query in your M2 database in order to delete the quotes data records and it’s child data (which were not migrated by our migration tool):
DELETE FROM quote WHERE entity_id NOT IN (SELECT m2_id FROM ub_migrate_map_step_7_quote);
(If you made no changes to default Magento 2 database structure, then the query above will delete all the quotes which were not migrated by our migration tool and it’s child data smoothly)
Then you can continue delta as normal.
PS. In case you have any new duplicated issue, we will follow up further on case by case basis.Type a message here
Regards,
Mall.