Magento 2 Data Migration Tool

Magento 2 Data Migration Tool

Magento 2  comes with a brand new architecture and database design. To ease up upgrade process, Magento has now made their plans for this process clearer with the release of a Magento 2 Data Migration Tool that will help to transfer your database from older versions to the latest Magento 2 in some simple steps.The data migration may be troublesome for new users, but no worries I am sure this blog post would be of help for you !

Latest Update: We’ve just released the version 2.0 of Claue Multipurpose Magento 2 Theme, with with a bunch of performance improvements and exclusive features. Check this theme out now: Claue Magento Theme  2. 0 

claue2_edited (1)

Live Demo 

Claue – Clean, Minimal Magento 2&1 Theme is an excellent template for a modern and clean eCommerce store with 40+ homepage layouts and tons of options for shop, blog, portfolio, store locator layouts and other useful pages. Claue version 2. 0  comes with a bunch of  exclusive features including:

  • Being based on Luma theme.
  • Meet all standards of Magento Theme
  • Significant performance improvement
  • Compatible with most third-party extensions.
  • Fully compatible with Magento 2.4.x

This second advanced version completely differentiates from its previous one. Thus, if you are using Claue version 1 and want to update to Claue version 2, you can only rebuild a new website no rather than updating from the old version. Now, let’s get back the main topic.

How to install the Data Migration Tool

You can install it from either or from a GitHub repository.
Everything is fairly well documented : Install the Data Migration Tool

There are 3 main commands/steps for the migration: settings, data and delta. This and their sub-steps can be seen in config.xml.

cd vendor/magento/data-migration-tool/bin/
php migrate --help
  migrate <mode> --config=path/to/config.xml [options]
  migrate --help
Possible modes:
  settings            Migrate system configuration
  data                Main migration of data
  delta               Migrate the data is added into Magento after the main migration
Available options:
  --reset             Reset the current position of migration to start from the beginning
  --config <value>    Path to main configuration file, i.e.: etc/m1_version/config.xml
  --verbose <level>   Verbosity levels: DEBUG, INFO, ERROR
  --help              Help information

Migrate Settings

You should migrate settings first. This mode migrates stores; websites; and different system configuration like shipping, payment, some tax settings etc.

Migrating data

When you migrate data, the Data Migration Tool verifies that tables and fields are consistent between Magento 1 and Magento 2. If not, an error displays that lists the problematic tables and fields. These entities, for example, can belong to some extensions from Magento 1 that do not exist in the Magento 2 database.

Migrate Delta

Now this is where it gets interesting. After successful data migration, you can always just append new M1 entries to M2 database with delta migration, it will continue where it stopped last time. Delta doesn’t migrate new or changed products or categories (at the moment of writing), only customers, orders, and similar customer related data.

While doing data migration, set of m2_* tables are created in your M1 database with set of triggers that enables tracking changes.

Delta is here to reduce migration time to minimum when going live with M2.

Migrate Media

Media files can simply be copy/pasted to appropriate places in M2 after products and categories are migrated, simple as that.

Customize Migration

Since there is no such thing as default Magento in the real world (XD), developers will always need to configure or customize this tool. The tool itself is flexible, since most of mapping is defined through xml files and filtered through php classes, Magento team really did good job here.

Let’s say we have custom varchar sales_flat_order.custom_column in M1. If we run data migration, we’ll end up with an error:

[ERROR]: Source fields not mapped. Document: sales_flat_order. Fields: custom_column

To ignore it we need to add following to map.xml file.


The only remark I have is that maybe unknown columns should be ignored by default. If there is column in M1 that isn’t defined in xml, the tool should ignore it, it would save lot of time.

Let’s say we want to move values to renamed custom_column and modify values in the process:

      <handler class="\Migration\Handler\AddPrefix">
        <param name="prefix" value="inchoo_"/>

Example shows that Handler class can be used, or custom one created, for changing values on the fly during migration.

If mapping isn’t enough, whole new custom step can be created. Each step is composed out of Integrity, Data and Volume classes. Integrity is triggered before migration to check if everything is ok with mapping, Data transfers data, Volume checks if everything is ok after migration. Delta class can be added to support delta migrations.

We have finished this tutorial, and I hope it’s useful for you. See you again in our next Magento 2 tutorials.

Enjoy Magento 2 challenge with Magesolution’s tutorials and follow our earlier blog posts on Magento 2 structure and benefits.

Source :

4382 Total Views 3 Views Today