Error at step 7 String data, right truncated:

Hi,
We are facing an error in migrating sales records by running  php -f bin/ubdatamigration run --step=7 --mode=update,

Please help us in resolving this ASAP.

Please see the below error,

Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘9522’ 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`, `store_to_quote_rate`, `grand_total`, `base_grand_total`, `customer_group_id`, `customer_note_notify`, `customer_is_guest`, `trigger_recollect`, `is_persistent`, `fee`, `base_fee`, `entity_id`, `created_at`, `updated_at`, `base_currency_code`, `store_currency_code`, `quote_currency_code`, `customer_id`, `customer_tax_class_id`, `customer_email`, `customer_firstname`, `customer_lastname`, `remote_ip`, `reserved_order_id`, `global_currency_code`, `base_to_global_rate`, `base_to_quote_rate`, `subtotal`, `base_subtotal`, `subtotal_with_discount`, `base_subtotal_with_discount`, `is_changed`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10, :yp11, :yp12, :yp13, :yp14, :yp15, :yp16, :yp17, :yp18, :yp19, :yp20, :yp21, :yp22, :yp23, :yp24, :yp25, :yp26, :yp27, :yp28, :yp29, :yp30, :yp31, :yp32, :yp33, :yp34, :yp35, :yp36, :yp37, :yp38)
 

 
Thanks

1 answer

Profile photo of Mall Staff 184060.00 $tone October 25, 2020
Public

Hi there,

Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘9522’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote` (`store_id`, `is_active`, `is_virtual`, `is_multi_shipping`, `items_count`,

You can try with these steps:

1. Run the following SQL queries 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');
Delete From sales_invoice Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_invoice where entity_name = 'sales_flat_invoice');
Delete From sales_invoice_item Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_invoice_item where entity_name = 'sales_flat_invoice_item');

2. And then, you continue with the data migration in sep #7.

Regards,
Mall.

#1

Please login or Register to Submit Answer

Written By

Comments