Magento – Magento 2 : How to reset the Data Migration Tool

data-migration-tooldelta-migrationmagento2magento2-migration-tool

I've inherited a mid-migration project from another dev, and need to start the data migration from scratch. It seems like it has been run before, and the M2 tables for product, customer, and order data have been truncated.

I've tried data and delta modes with and without reset, dropping the m2_cl tables from M1, and even importing the correct product, customer, and order info into those tables, but I keep getting the same vague warning when I run the migration:

[WARNING]: Mismatch of entities in the document: sales_order_grid Source: 17857 Destination: 0

Any ideas?

Best Answer

I am aware that this is an old question, but for others looking to do the same in the future I have compiled a few steps. As of current versions of Magento Data Migration Tool - June 2020 the issue is still not fixed.

If you want to run --reset, you may experience failure later on, especially with eav related failures, for instance eav_attribute_group table errors. NOTE: Any other attribute issues are similarly caused.

This eav_attribute_group issue that you mentioned as far as I remember only occurs when you try to run bin/magento migrate:data --reset again once a previous migration already migrated all the attributes. I seem to recall the migration tool confused with the IDs of the groups, so just restart from the beginning.

So some steps that may assist:

  1. Install Magento 2.3.x completely, setup modules etc, setup backend settings that you want. Once you have a working database before even migrating M1 data, make a backup of this M2 database state.... because you will most likely restart alot of times because of migration issues. So create a full m2_full_install_before_migration.sql backup.

  2. Create the same for Magento 1 database - until you are at the point where you can migrate without failures, you can restore this as well. NOTE: Delta migration is useless until you have successful migrate:data.

  3. DROP M2 migrated database and restore from SQL in step 1.

  4. VERY IMPORTANT - The most important step of all:
    Delete the var/migration* files in Magento 2 folder. These files are used by the tool it seems to keep track of where you stopped previously. So since the migration does not work 100% yet, just restart from the beginning. (this might also be why you have group issues). I always delete these files.

  5. So a complete DROP/RECREATE, RESTORE M2 DB, setup:upgrade, migrate data from M1 copy (locally) takes around an hour in my case because I have done it so many times.

  6. I would ignore migrate:delta for now if I were you, you will have to restart so many times. Get data working, make notes of issues that are specific to your instance, so that you could do things step by step.

Good luck!

Related Topic