Magento2 Data Migration Tool

Basic Information about Data migration tool

As we all know that, Magento 2 will come with a new architecture and database design. To ease up upgrade process, Magento released official Data Migration Tool that will help developers migrate store data from Magento 1 to Magento 2.

Important: This tool only transfers data. Themes and customizations of your store can’t be automatically changed or migrated to Magento2.

Magento 2 Migration tool- main features

  • Migrate Stores, Store views
  • Migrate Attribute Sets, Attribute Groups, Attributes
  • Migrate Categories
  • Migrate Products
  • Migrate Customers
  • Migrate Sales Data: Sales Orders, Sales Invoices, Sales Shipments…
  • Migrate Product Reviews, Rating data.

Data Flow Diagram:

The following diagram shows the flow of Magento1 to Magento 2 migration.

Internal Structure for Data Migration Tool

Data Migration Tool

For Data Migration Magento provides the Data Migration Tool, a command-line interface (CLI) that provides verification, progress tracking, logging, and testing functions.

The migration tool operates in three modes to transfer and receive data from Magento 1 to Magento 2:

  • Settings mode: Migrates all possible configuration settings from Magento 1 to Magento2
  • Data mode: Bulk migrates data from your Magento 1 database to your Magento 2 database
  • Delta mode: Incremental “catch-up” migration after the initial bulk data migration

Preconditions before you run the Migration tool

A. Check that the data migration tool has a network connection to the Magento 1 and Magento 2 databases.

B. For communicating the migration tool with database open ports in your firewall.

C. Disable all the cron jobs of Magento2.

D. Set up the configuration and mapping files.

Install the Data Migration Tool

Step1:After Download the Data Migration tool You install tool into empty Magento2 installation with Composer.

It’s not an extension, but standalone shell app that requires Magento2 framework to work. It’s located in vendor/magento/data-migration-tool/bin/migrate.

Step2:Before migrate the data you must edit configuration file and the path of the file vendor/magento/data-migration-tool/etc/ce-to-ce/ folder.

Step3: For changes edit in configuration minimum required would be source(M1) and destination(M2) database connections in config.xml like below screen shoot.

Step4: As above described code is sufficient if you want to add password and table prefix parameter follow below structure.

Database user password: password=

Table prefix:,

For example, if your database owner’s user name is root with password pass and you use the prefix magento1 in your Magento 1 database, use the following in config.xml:

Step5: The Data Migration Tool uses mapping files to enable you to perform custom database mapping between your Magento 1 and Magento 2 databases.

Step6: The custom database mapping includes

  • Changing table names
  • Changing field names
  • Ignoring tables or fields
  • Adapt transferring data of a field to Magento 2 format

Step7: Mapping files for supported Magento versions are located in subdirectories ofyour Magento 2 install dir>/vendor/magento/data-migration-tool/etc

Step8: To use the mapping files:

  • Rename or copy them to remove the .dist extension.
  • Edit them using the schema located in
    /vendor/magento/data-migration-tool/etc.
  • Then change config.xml in node with the new name of the file.

Step9: The below directory contains the following configuration files:

/vendor/magento/data-migration-tool//etc

Mapping file name Description
class-map.xml.dist Dictionary of class mappings between Magento 1 and Magento 2
dfsconfig.xml.dist Main configuration file that specifies the Magento 1 and Magento 2 database configurations, step configuration, and links to mapping files
customer-attr-document-groups.xml.dist List of tables used in the custom customer attributes step.
customer-attr-map.xml.dist Map file that is used in Custom Customer Attributes Step.
deltalog.xml.dist Contains the list of tables required for database routines setup.
eav-attribute-groups.xml.dist Contains list of attributes that are used in Eav Step.
eav-document-groups.xml.dist Contains list of tables that are used in Eav Step.
map-eav.xml.dist Map file that is used in EAV Step.
map-log.xml.dist Log mapping file.
EE only. map-sales.xml.dist Map file that is used in SalesOrder step.
settings.xml.dist Setting migration configuration file that specifies rules required for migrating the core_config_data table.
customer-attribute-groups.xml Contains list of attributes that are used in Customer Attributes Step.
customer-document-groups.xml Contains list of tables that are used in Customer Attributes Step.
map-customer.xml Map file that is used in Customer Attributes Step.
order-grids-document-groups.xml Contains list of tables that are used in OrderGrids Step.

Migrate settings:

First, you migrate settings, websites and stores to Magento2. Most of Magento data is related to websites and stores, so this needs to go first. To change how settings are migrated:

1. Rename or copy settings.xml.dist in a folder “etc//” to remove the .dist extension.

2. After remove .dist it comes settings.xml.

3. Make changes to config.xml tag so it would have a new file name of the settings file.

Command usage:

cd /vendor/magento/data-migration-tool/bin
php migrate settings –config=

Migrate 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.

If you encounter such an error, you can:

  • Install the corresponding extensions in Magento 2 if they exist
  • Ignore them by adding tags to the map.xml file

After resolving issues, run the Data Migration Tool again.

To run the Data Migration Tool, use the following command:

cd /vendor/magento/data-migration-tool/bin
php migrate data –config= [–reset]

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 l

Data that should be migrated manually as follow:

In the manually migration of data there are three things:

  • Media
  • Storefront Design
  • ACls

Migrate Media: Meadia can migrate fro admin panel by follow the following steps

This section applies to you only if you store media files in the Magento database. This step should be performed before migration of data.

Step1: Log in to the Magento 1 Admin Panel as an administrator.

Step2: After that go to System->configuration.

Step3: After that go to System under Advanced tab.

Step4: Now go to Storage Configuration for Media, Select Media Database list, click the name of your media storage database. Then click on synchronize.

Step5: After that login to magento2 admin panel as administrator..

Step6: Then go to Stores->Configuration.

Step7: Then go to System under Advanced tab

Step8: Now go to Storage Configuration for Media, Select Media Database list, click the name of your media storage database. Then click on synchronize button.

Media files on the file system

Copy media folder from magneto1 to magento2 manually but one thing should be noted do not copied the .htaccess file because magneto 2 already have .htaccess file

Storefront design

  • Design in files (css, js, templates, XML layouts) changed its location and format
  • Layout Updates stored in database. Placed through Magento 1 Admin in CMS Pages, CMS Widgets, Category Pages and Product Pages.

ACLs (Access Control Lists)

  • You must manually re-create all credentials for web services APIs (that is, SOAP, XML-RPC, and REST)
  • You must manually re-create all administrative users and associate them with access privileges

After Migration

After you have completed your migration and thoroughly tested your new Magento 2 site, perform the following tasks:

  • Put Magento 1 in maintenance mode and permanently stop all Admin activities
  • Start Magento 2 cron jobs
  • Flush magneto2 cache.
  • Reindex all magento2 indexers.
  • Change DNS, load balancers, and so on to point to Magento 2 production hardware.