Insider Information: Migrate Customers Data to Magento 2

Sept 13, 2016 Update: We had chance to interview Radford Castro — Lead Developer at about the custom data migration project that I referred to below. Here is the details of the interview

Our team had a chance to work on a custom migration project two weeks ago that a client needed our help to port only Customer data (382,047 records) to Magento 2.

This is an interesting Magento 2 migration task indeed.

Customer data is always of great importance to any Magento store and it’s a must-have item to be migrated. Let’s take this chance to have a closer look into significant perspectives related to migrating Customer data in Magento.

Migrate Customer Data in Magento 2

Insider Information: Migrate Customers Data to Magento 2

You might have a few questions in mind before migration:

  • Does it require your customers to change their password after migration?
  • What are the changes in the (Magento 1) Customer’s table structure, compared to Magento 2?
  • For a Magento store with big customer data, how to flexibly migrate such data portion?

As you can see, when coming to particular Magento’s database migration, beside Customer, it involves in different components -- Websites, stores, store views; Attribute sets, attribute groups, attributes; Categories; Products; Sales data; Product reviews, Rating data; Other data like tax rules etc. If you wish to have a quick overview into these data portions, this infographic will help -- Key changes in Magento 1 vs Magento 2 database structure.

For now, let’s dive in the Customer data in Magento 2.

Customer Passwords

Will it require customers to change their password after migration?

If you use a 3rd party data migration tool, please contact your provider to confirm on this. In our case -- using the UB Data Migration tool, the answer is No.

As you might know, Magento 2 has changed the encryption model. It uses a new method of hashing passwords sha256(), while Magento 1 uses MD5 which produces hash values of length n=128.

However, one thing to note that Magento 2 still supports both old md5() and sha256(). That means you can have both password_hash in your Magento 2.

Our migration tool takes advantage of such backward compatibility in Magento to automatically migrate Customer password from Magento 1 to Magento 2. So your customers can use their md5() based password without the need to reset their passwords after migration. And the (migrated) customer passwords in Magento 2 remain to be 128-bit (16-byte) MD5 hashes. Such passwords will be changed to sha256() hash algorithm if:

  • Your users change the password themselves on the new Magento 2 instance (after migration). Or,
  • You manually upgrade your password_hash using md5() to sha256() after migration, by running the command: php -f bin/magento customer:hash:upgrade.

Customer table structure changes

Before going into details of the changes of Customer data structures, we should take a look at the structure of tables in which customer information is stored.

Customer data structures in Magento

Customer data structures in Magento

Customer Information uses EAV structure to store all information, with the following key entity tables:

  • The main entity table, where customer information is stored: customer_entity
  • The customer entity attribute tables: customer_entity_datetime, customer_entity_decimal, customer_entity_int, customer_entity_text, customer_entity_varchar

As Customer data is especially important while you deal with Magento data migration, it’s crucial to see which changes have occurred in all customer data tables. Based on our experience with UB Data Migration tool since early 2015, we found some significant changes in the structure of customer database in Magento 2 vs. Magento 1:

  1. The ‘entity_type_id’, ‘attribute_set_id’ fields have been removed in the ‘customer_entity’, ‘customer_address_entity‘ tables
  2. The ‘entity_type_id’ field has been removed in some tables, for instance: ‘customer_address_entity_datetime’, ‘customer_address_entity_decimal’ etc.
  3. In the ‘customer_eav_attribute’ table, the data model value was changed. For instance, the customer/attribute_data_postcode was replaced with Magento\\Customer\\Model\\Attribute\\Data\\Postcode
    And the ‘is_used_for_customer_segment’ field was deleted as well.
  4. EAV of customer data structure was changed, some attributes were moved to the main table ‘customer_entity’, including some new fields ‘created_in’, ‘firstname’, ‘middlename’, ‘lastname’, ‘password_hash’, ‘rp_token’, ‘rp_token_created_at’, ‘prefix’, ‘suffix’, ‘dob’, ‘default_billing’, ‘default_shipping’, ‘taxvat’ etc.
  5. EAV of customer_address_entity data structure was changed, some attributes were moved from the children tables to the main table `customer_address_entity`: Country_id, firstname, lastname, middlename, street, telephone, city, fax, company, country_id, postcode, prefix, region, region_id, suffix, vat_id etc.
  6. Magento CE 2.x changed the method of hashing passwords from md5() to sha256(), however Magento 2 still supports the options, as explained in section 1 -- Customer Passwords above.

The above list narrows down to the particular Customer tables only, if you wish to dive in all key changes in Magento 2 database, the infographic -- Magento 1 vs Magento 2 data structure changes -- will give you the whole picture.

So, how will the changes in the Magento 2 database affect your migration plan?

Actually, in spite of such complexity, you will not have to manually port each customer table with changes to Magento 2. This is where migration tool comes in and does all hard work for you.

How to cope with Big data migration

There is a high chance that you have a medium or large scale Magento store, with hundreds of thousands of records or up to million of orders. How to proceed migration process under such circumstances?

Or when you set up a staging Magento 2 site, is it possible to do a delta/update migration at a later point to migrate any new customers and orders that are created between the first migration and the shop launch?

The answer is to get the right data migration tool, an important first step.

As data migration is a complex process, the migration tool should give you confidence that your data will be transferred efficiently and reliably.

To assist you with your database migration, I’d like to introduce an option for your consideration -- UB Data Migration Pro, a data migration tool that has effectively and reliably migrates all core Magento database. The tool support the following Magento versions:

  • Magento CE 1.x: 1.6.x, 1.7.x, 1.8.x, 1.9.x
  • Magento CE 2.0.0 and later

There’s a video tutorial of UB Data Migration Pro in use: here.

(Work-in-progress) UB Data Migration Pro v3.0
At present, we are actively working on a huge overhaul to better enhance our existing UB Data Migration Pro version 2.0.5.

UB Data Migration Pro V3

A glance at our work-in-progress UB Data Migration Pro 3.0

The new UB Data Migration Pro v3.0 will come with enhancements, a few to name:

  • Ability to migrate data to Magento 2 site with existing database (our current UB Data Migration Pro 2.0.5 requires that Magento 2 site must be a fresh installation)
  • Enhancement with delta/update migration: after you complete the first migration, you can migrate new data from M1 site without resetting and re-migration the whole data section like in our UB Data Migration Pro 2.0.5
  • Allow to migrate multiple times
  • Apply data batch to improve server performance
  • Re-engineer the workflow to simplify the pre-migration configuration


With this post, it’s my hope that you now have a better idea of different perspectives related to Customer data and data migration in Magento 2.

I also gave an overview of our migration tool, in case you consider to give it a try. If you do, it’s a good starting point to explore our latest free version -- UB Data Migration Lite.

Even though this article points out some key things related to Customer data only, I am open to discuss other aspects you need to consider for the migration. Feel free to let me know in the comment below.

Written By