How to retain the primarykey for Sales & Others ?

Team,
How to retain of primarykeys while migrating Sales & Others modules in the tool (UB Data Migration Pro) ? 
 

7 answers

Profile photo of Mall Staff 184060.00 $tone February 23, 2017
Public

Hi lakvenkat,

How to retain of primarykeys while migrating Sales

You can open the php file at path: pub/ub-tool/protected/controllers/Step7Controller.php
and find to the code line: 

$salesOrder2->entity_id = null;

and replace it by code line:

//$salesOrder2->entity_id = null;

& Others modules in the tool (UB Data Migration Pro) ? 

Kindly specify the data objects which you want to retail primary key. I will tell you workaround to solve that.
Please note that: This options can working with a Magento2 fresh installation only.
Regards,
Mall.

#1
Profile photo of lakvenkat 1000.00 $tone March 14, 2017
Public

Mall,
I need to retain below mentioned Primarykeys of the Data Objects.
Reviews,Rating,Product Tier Prices,Product Group Prices,Tax Data,Catalog Rules,
Email Templates and Newsletter Data,Update System Increment IDs (EAV Entity Store)
Thanks
Vijay

#2
Profile photo of Mall Staff 184060.00 $tone March 14, 2017
Public

Hi there,

Reviews, Rating, Product Tier Prices, Product Group Prices, Tax Data, Catalog Rules, Email Templates and Newsletter Data,Update System Increment IDs (EAV Entity Store)

To retails the primary keys of that object lets do steps as bellow:
1 -- Open the php file at: pub/ub-tool/protected/controllers/Step8Controller.php
2 -- And find to the code line:

$model2->review_id = null;

and replace it by code line:

//$model2->review_id = null;

3 -- And find to the code line:

$model2->rating_id = null;

and replace it by code line:

//$model2->rating_id = null;

4 -- And find to the code line:

$model2->value_id = null;

and replace it by code line: (FYI: we can’t retail ids of Group Price records)

if (get_class($model) == 'Mage1CatalogProductEntityGroupPrice') {
$model2->value_id = null;
}

5 -- And find to the code line:

$taxClass2 = new Mage2TaxClass();

and replace it by code lines:

$taxClass2 = new Mage2TaxClass();
$taxClass2->class_id = $taxClass->class_id;

6 -- And find to the code line:

$model2->tax_calculation_rate_id = null;

and replace it by code line:

//$model2->tax_calculation_rate_id = null;

7 -- And find to the code line:

$model2->tax_calculation_rule_id = null;

and replace it by code line:

//$model2->tax_calculation_rule_id = null;

8 -- And find to the code line:

$model2->rule_id = null;

and replace it by code line:

//$model2->rule_id = null;

9 -- And find to the code line:

$ruleProduct2->rule_product_id = null;

and replace it by code line: 

//$ruleProduct2->rule_product_id = null;

10 -- And find to the code line:

$groupWebsite2->rule_id = $ruleId2;

and replace it by code line:

//$groupWebsite2->rule_id = $ruleId2;

11 -- And find to the lines with code (two lines):

$model2->template_id = null;

and replace it by code line:

//$model2->template_id = null;

12 -- And find to the code line:

$model2->subscriber_id = null;

and replace it by code line:

//$model2->subscriber_id = null;

13 -- And find to the code line: 

$newsletterQueue2->queue_id = null;

and replace it by code line:

//$newsletterQueue2->queue_id = null;

14 -- And find to the code line:

$model2->entity_type_id = $entityTypeId2;

and replace it by code lines:

$model2->entity_store_id = $model->entity_store_id;
$model2->entity_type_id = $entityTypeId2;

Let’s do it to retail the primary key with objects which you want.
And tell me know how it goes.
Regards,
Mall.
 

#3
Profile photo of lakvenkat 1000.00 $tone March 14, 2017
Public

Mall,
I received below error messages while migrating OTHERS using  UB Data Migration Pro tool .
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘1’ for key ‘PRIMARY’
Thanks
Vijay

#4
Profile photo of Mall Staff 184060.00 $tone March 14, 2017
Public

Hi lakvenkat,
Did you do exactly as my suggesting for your working?
Does your Magento2 is a fresh installation?
Please note that:
As i said in first reply. Some above tweak code to retail the primary key can working with a Magento2 fresh installation only.
Let’s enable debug mode of our tool:
Open the file pub/ub-tool/index.php
and find to the code line:

#ini_set('display_errors', 1);

and replace it by code line:

ini_set('display_errors', 1);

and find to the code line:

#defined('YII_DEBUG') or define('YII_DEBUG', true);

and replace it by code line:

defined('YII_DEBUG') or define('YII_DEBUG', true);

And re-run the data migration in the step which you got the issue.
And then, provide me the detail information of the duplicate issue as you mentioned in the log of our tool at:
pub/ub-tool/protected/runtime/ub_data_migration.log
Regards,
Mall.
 

#5
Profile photo of lakvenkat 1000.00 $tone March 14, 2017
Public

Mall,
Did you do exactly as my suggesting for your working?
Yes

Does your Magento2 is a fresh installation?
Yes
And then, provide me the detail information of the duplicate issue as you mentioned in the log of our tool at:
pub/ub-tool/protected/runtime/ub_data_migration.log
 [error] [ub_data_migration] CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘1’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `tax_calculation_rate` (`tax_calculation_rate_id`, `tax_country_id`, `tax_region_id`, `tax_postcode`, `code`, `rate`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5)
Vijay

#6
Profile photo of Mall Staff 184060.00 $tone March 14, 2017
Public

Hi there,

INSERT INTO tax_calculation_rate

Because the default of Magento fresh installation has some init data in this table tax_calculation_rate.
So, we can’t retail the primary key of that table from Magento1 -> Magento2.
So, let’s open the file at: pub/ub-tool/protected/controllers/Step8Controller.php
and find to the code line:

//$model2->tax_calculation_rate_id = null;

and replace it by code line:

$model2->tax_calculation_rate_id = null;

And then, you can continue with data migration in the step #8.
And tell me know how it goes.
Regards,
Mall.

#7

Please login or Register to Submit Answer

Written By

Comments