Hi Support,
We are an issue in migrating customers. The issue is below
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘11439’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `customer_address_entity` (`is_active`, `entity_id`, `parent_id`, `created_at`, `updated_at`, `country_id`, `firstname`, `lastname`, `street`, `telephone`, `city`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
When I debug I found that this customer has multiple address. so I think the issue is where customer has multiple address
THanks
Dinesh
7 answers
Hi there,
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘11439’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `customer_address_entity` (`is_active`, `entity_id`, `parent_id`, `created_at`,
That issue because you checked ‘KEEP ORIGINAL IDs’ in settings in step #6 and your M2 has sample or testing data on customer data section.
To continue, you can do following steps:
+ Run CLI command:
php -f bin/ubdatamigration clean --step=6
+ Once done, continue with data migration in step #6:
php -f bin/ubdatamigration run --step=6
Regards,
Mall.
Hi Support,
When I run the first command it is showing command not found.
Yii command runner (based on Yii v1.1.19)
Usage: bin/ubdatamigration <command-name> [parameters…]
The following commands are available:
-- cleanduplicateurl
-- fixduplicateurl
-- message
-- migrate
-- reset
-- run
-- shell
-- webapp
To see individual command help, use the following:
bin/ubdatamigration help <command-name>
Please let me know what should I do next.
Thanks
Dinesh
Hi there,
When I run the first command it is showing command not found.
That because you are used old version of our migration tool. To continue with current version, you can do steps below:
+ Run following SQL in your M2 database:
DELETE FROM ub_migrate_map_step_6 WHERE entity_name = 'customer_group' AND m2_id NOT IN (Select customer_group_id From customer_group);
DELETE FROM ub_migrate_map_step_6 WHERE entity_name = 'customer_entity' AND m2_id NOT IN (Select entity_id From customer_entity);
DELETE FROM ub_migrate_map_step_6_customer_address WHERE entity_name = 'customer_address_entity' AND m2_id NOT IN (Select entity_id From customer_address_entity);
+ Once done, clean cache of our migration tool by run command: rm -rf pub/ub-tool/protected/runtime/cache/
+ And then, you can continue with data migration in step #6:
php -f bin/ubdatamigration run --step=6
Regards,
Mall.
Again getting same error after done above steps
Hi there,
Again getting same error after done above steps
Please run more following SQL in your M2 database:
Delete From customer_address_entity Where entity_id =11439;
+ And then, continue with data migration in step #6:
php -f bin/ubdatamigration run --step=6
Regards,
Mall.
Hi Support,
There is no any data for customer, orde, sales rule e.tc. we have truncate the table for clean the test order and customer.
and we are still gettting the same issue .
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘11439’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `customer_address_entity` (`is_active`, `entity_id`, `parent_id`, `created_at`, `updated_at`, `country_id`, `firstname`, `lastname`, `street`, `telephone`, `city`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8, :yp9, :yp10)
Please let me know the correct solution.
Hi there,
and we are still gettting the same issue .
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘11439’ for key ‘PRIMARY’.
If you already did all steps as suggested in my reply #5, then the issue is strange. I need to take a closer look to detect the root cause of that issue. Please provide me information of your instance:
- Admin credentials of your M2 site
- SSH credentials of your M2 site
- Let me know the path to your M2 folder
I will help to check further and get back to you then.
PS. Please mark your reply private, or simply switch this ticket to the private mode, then it’s safe to share your site info here. Only you and our technical team can access.
Regards,
Mall.