Errors generated when trying to re-run migration

We set up our Magento 2 store several months ago and ran the initial migration at that time. Since then there have been several changes to products and categories on the M1 store, as well as additional orders and customers created, etc.
 
We wish to completely re run the migration to capture all of these changes but when we do we receive many errors.
One is:
Fatal error: Uncaught Error: Call to a member function getDefaultCurrencyCode() on null in
 
Another when trying to access the admin panel is:
Exception #0 (Exception): Notice: Undefined index: in /vendor/magento/module-developer/Model/View/Page/Config/RendererFactory.php on line 70

14 answers

Profile photo of Mall Staff 184060.00 $tone July 31, 2019
Public

Hi there,
How did you rerun data migration? Do you got finished in all steps?
The issues you mentioned is strange and it relates to Magento’s core function. I need a closer look to detect the root of that issues. Lets provide me more information about your instance:
+ URL and Admin credentials of your M2
+ SSH credentials and path to M2 folder
Regards,
Mall.

#1
Profile photo of jammy-git 110.00 $tone August 1, 2019
Public

We’ve tried to re-run migration steps using both -update and -reset. We’ve tried only running particular steps and we’ve tried running all the migrations steps from step 1 through to the end. Every time we get an error, usually on step 4 saying an id doesn’t exist.

#3
Profile photo of Mall Staff 184060.00 $tone August 2, 2019
Public

Hi there,

 We’ve tried only running particular steps and we’ve tried running all the migrations steps from step 1 through to the end. Every time we get an error, usually on step 4 saying an id doesn’t exist.

What is the issue you want to mentioned?
I checked your site and I saw you got finished in all steps of our migration tool: https://prnt.sc/on9d8j
And I didn’t see the issue you mentioned: 

Another when trying to access the admin panel is:
Exception #0 (Exception): Notice: Undefined index: in /vendor/magento/module-developer/Model/View/Page/Config/RendererFactory.php on line 70

Regards,
Mall.

#4
Profile photo of jammy-git 110.00 $tone August 2, 2019
Public

 Yes, as I said in my first post we have performed the migration once already. We’re now trying to re-run the migration, but every time we do we get stuck and it is a different error message depending on whether we run an update or a reset migration.
Please run the migration for yourself and you will see the error.

#5
Profile photo of Mall Staff 184060.00 $tone August 3, 2019
Public

Hi there,

We set up our Magento 2 store several months ago and ran the initial migration at that time. Since then there have been several changes to products and categories on the M1 store, as well as additional orders and customers created, etc.

For that case, you should run delta migration with update mode in all steps which you need to run. Reset is not needed.
Example you want to update new changes of categories in M1, you could run delta in step #4 with update mode by run CLI command:
php -f bin/ubdatamigration run --step=4 --mode=update;
Regards,
Mall.

#6
Profile photo of jammy-git 110.00 $tone August 4, 2019
Public

I’ve run step 4 without errors now, though I am yet to check if all changes have migrated.
 
I have run step 5 and received the following error:

Status: fail
Message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘16979’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `catalog_product_entity_media_gallery` (`attribute_id`, `media_type`, `disabled`, `value_id`, `value`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)

#7
Profile photo of Mall Staff 184060.00 $tone August 5, 2019
Public

Hi there,

Duplicate entry ‘16979’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `catalog_product_entity_media_gallery` (`attribute_id`, `media_type`, `disabled`, `value_id`, `value`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)

That issue occurred because you checked the ‘KEEP ORIGINAL IDs’ option in Step #5 of our module, while you added some sample products after the first migration.
 
To solve the duplicated issue you mentioned, you can run below SQL to delete the duplicated record in the table ‘catalog_product_entity_media_gallery’:

Delete From catalog_product_entity_media_gallery Where value_id = 16979;

+ Once done, you can continue with data migration in step #5 by running this command:
php -f bin/ubdatamigration run --step=5;

Regards,
Mall.

#8
Profile photo of jammy-git 110.00 $tone August 5, 2019
Public

Is there any way to just delete all the products, categories, orders, customers, invoices, etc from the M2 store and migrate everything fresh from an up-to-date copy of the M1 database?
 
Now that we’ve finished development of the M2 database we don’t care about the data in it (other than settings and CMS content), we just want an up-to-date copy of the data from the M1 store so we can go live.

#9
Profile photo of Mall Staff 184060.00 $tone August 5, 2019
Public

Hi there,

Is there any way to just delete all the products, categories, orders, customers, invoices, etc from the M2 store and migrate everything fresh from an up-to-date copy of the M1 database?

Yes, you can do steps below:
+ Reset data migration in all step by running the command:
php -f bin/ubdatamigration reset;
+ Once done, navigate back to the back-end dashboard of our migration tool, configure and start data migration in all steps as our per guide.

Regards,
Mall.
 

#10
Profile photo of Mall Staff 184060.00 $tone August 16, 2019
Public

Hi there,

See: https://kbr.tech4-magento2.thecode.company/

After you re-set the step #4, all migrated categories were deleted by our migration tool. However, the Top menu in your site still loads the category which has the entity id = 8. This caused the error that you mentioned.

I checked further in your back-end and saw you had finished data migration in all steps of our migration now: https://prnt.sc/otas0u. But you have not configured the Root Category for the current default Store of default website in your site yet: https://prnt.sc/otarmu
 
Please assign the Root category for the default Store in the Stores management panel in your M2 back-end. Once done, reindex the data and clean M2 cache.
 
PS. For your information, The admin credential you provided did not work, I created a new temporary admin user named ‘ub’ via SSH.

Regards,
Mall.
 

#12
Profile photo of Mall Staff 184060.00 $tone August 21, 2019
Public

Hi there,

I checked the product you mentioned and saw the root cause of the ‘out of stock’ status as in this screenshot: https://prnt.sc/ove1so
 
That was because the product had missing ‘Salable quantity’ value (this data section is new from M2.3.1). 

The Salable Quantity is a new data section from M2.3.1. And this data section did not exist in your M1 database. To automatically fill this data section from Product’s stock data section, you can try steps below:
+ Download the PHP file here
and then, upload that file to the path: pub/ub-tool/protected/models/mage2/Mage2InventorySourceItem.php
+ Download the PHP file here
and then upload to overwrite the file at: pub/ub-tool/protected/controllers/Step5Controller.php
 
Then, run delta migration in step #5 with the ‘update’ mode by running the below CLI command:
php -f bin/ubdatamigration run --step=5 --mode=update;
 
Once done, reindex the data and clean M2 cache and check the issue you mentioned again.
 
Regards,
Mall.
 

#14

Please login or Register to Submit Answer

Written By

Comments