Duplicate entry

Hi there, 
          We are trying to do delta migration and we have manually updated Db config and ran the cmd php -f bin/ubdatamigration run --mode=update on step #6 and step #7 we are getting the below error.

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

Also FYI, so far step #5 is not throwing any Duplicate entry errors. 
KEEP ORIGINAL IDS are not checked in our setup. Here we are not sure what causes this issue.

In this ticket we have provided our server details https://www.ubertheme.com/question/migration-page-redirected-to-404/

Could you please look into it and share your comments!

3 answers

Profile photo of Mall Staff 178190.00 $tone March 7, 2022
Public

Hi there,

Status: fail
Message: Mage2CatalogProductBundleOption: Parent Id cannot be blank.

This is because your M1 database has some bad data records in the table named ‘catalog_product_bundle_option’
To solve you can try these steps:
+ Open the PHP file at path: pub/ub-tool/protected/controllers/Step5Controller.php
and find to the code lines:

/**
* Table: catalog_product_bundle_option
*/
foreach ($models as $model) {
$optionId2 = UBMigrate::getM2EntityId(
'5_product_option',
'catalog_product_bundle_option',
$model->option_id
);
$parentId2 = (!$keepOriginalId)
? UBMigrate::getM2EntityId(5, 'catalog_product_entity', $model->parent_id)
: $model->parent_id;

and replace with these code lines:

/**
* Table: catalog_product_bundle_option
*/
foreach ($models as $model) {
$optionId2 = UBMigrate::getM2EntityId(
'5_product_option',
'catalog_product_bundle_option',
$model->option_id
);
$parentId2 = (!$keepOriginalId)
? UBMigrate::getM2EntityId(5, 'catalog_product_entity', $model->parent_id)
: $model->parent_id;
if (!$parentId2) continue;

+ Once done, you can continue with delta migration in step #5.

We don’t think deleting that customer would be considered as a fix. The customer details which are suggested to delete is a valid data which migrated from the M1. It is not test data created directly in M2. Please refer this screenshot take from M1 https://tinyurl.com/y84rebac

The issue captured in the migration log of our tool is a bit strange (pub/ub-tool/protected/runtime/ub_data_migration.log)
Please consider delta migration in step #5 first.
Then you can continue to run delta migration in step #6 and step #7 by running the CLI commands:

php -f bin/ubdatamigration run --step=6 --mode=update;

and then:

php -f bin/ubdatamigration run --step=7 --mode=update;

Let me know how it goes.
 

Regards,
Mall.
 
 

#
Profile photo of Mall Staff 178190.00 $tone March 7, 2022
Public

Hi there,

Could you please look into it and share your comments!

I checked in your instance and saw that you got an error message in step #5:

2022/03/07 05:30:51 [error] [ub_data_migration] The table “{{inventory_source_item}}” for active record class “Mage2InventorySourceItem” cannot be found in the database.

It seems that you have not installed the core MSI module in your M2. To handle that case, you can try these steps:
+ Open the PHP file at path: pub/ub-tool/protected/controllers/Step5Controller.php
and find to the code line:

$msiEnabled = 1; //1- enabled MSI module, 0 - disabled MSI module

and replace with this code line:

$msiEnabled = 0; //1- enabled MSI module, 0 - disabled MSI module

+ Once done you can continue with delta migration in step #5.
 
I saw that you got a duplicated error message in step #6:

2022/03/07 05:34:48 [error] [ub_data_migration] CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘[email protected]’ for key ‘CUSTOMER_ENTITY_EMAIL_WEBSITE_ID’. The SQL statement executed was: UPDATE `customer_entity` SET `entity_id`=:yp0,

This happened because there’s a customer with email = ‘[email protected]’ in your M2 and it conflicted with a migrated customer who has the same email. To solve it you must delete the customer who uses the email ‘[email protected]’ in your M2 first: http://prntscr.com/T1PvFJISAgsx
Then you can continue with delta migration in step #6.
 
You also got a duplicated error message in step #7:

Integrity constraint violation: 1062 Duplicate entry ‘SFT5’ for key ‘SALESRULE_COUPON_CODE’. The SQL statement executed was: UPDATE `salesrule_coupon` SET `coupon_id`=:yp0, `rule_id`=:yp1, `code`=:yp2, `usage_limit`=:yp3, `usage_per_customer`=:yp4, `times_used`=:yp5, `expiration_date`=:yp6, `is_primary`=:yp7, `created_at`=:yp8, `type`=:yp9, `generated_by_dotmailer`=:yp10 WHERE `salesrule_coupon`.`coupon_id`=’2′

This happened because your M2 instance has a sales coupon code = ‘SFT5’ and it conflicted with a migrated sales coupon code.
To solve it you need to change the sales coupon code ‘SFT5’ in your M2 first: http://prntscr.com/UyQFqZvj5voU
Then you can continue with delta migration in step #7.
 

Regards,
Mall.

#1
Profile photo of plasticcontainercity 0.00 $tone March 7, 2022
Public

Thanks for the quick response. For the Step #5 after disabling the MSI and running the command php -f bin/ubdatamigration run --step=5 --mode=update  after some time we got the below. 


[Processing][delta] Step #5 migration completed with 100 record(s) in the ‘catalog_product_bundle_option’ table.
………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………
Status: fail
Message: Mage2CatalogProductBundleOption: Parent Id cannot be blank.<br/>Mage2CatalogProductBundleOption: Parent Id cannot be blank.<br/>Mage2CatalogProductBundleOption: Parent Id cannot be blank.<br/>Mage2CatalogProductBundleOption: Parent Id cannot be blank.<br/>Mage2CatalogProductBundleOption: Parent Id cannot be blank.<br/>Mage2CatalogProductBundleOption: Parent Id cannot be blank.

For the step #6:

To solve it you must delete the customer who uses the email ‘[email protected]’ in your M2 first:

We don’t think deleting that customer would be considered as a fix. The customer details which are suggested to delete is a valid data which migrated from the M1. It is not test data created directly in M2. Please refer this screenshot take from M1 https://tinyurl.com/y84rebac
For the step #7: 

To solve it you need to change the sales coupon code ‘SFT5’ in your M2

Same here too changes coupon code wouldn’t  be an good idea. The coupon code = ‘SFT5’ is a valid data Migrated. Please take a look into this screenshot take from M1 https://tinyurl.com/y9u4lb92

Kindly share your comments and help us out.
 

#2

Please login or Register to Submit Answer

Written By

Comments