As you is perhaps most definitely acutely aware of, Magento 2 will embrace a model new structure and database design. To ease up upgrade course of, Magento launched official Data Migration Tool which will help developers migrate retailer data from Magento 1 to Magento 2.
Official sources:
- (*2*)
- Migration Guide
- (*2*)
Data Migration Tool transfers data from M1 database to M2 database based mostly totally on set of pointers outlined in xml files. To be clear, this instrument solely transfers data. Themes and customizations of your retailer can’t be robotically modified or migrated to Magento2.
You install instrument into empty Magento2 installation with Composer. It’s not an extension, nevertheless standalone shell app that requires Magento2 framework to work. It’s positioned in vendor/magento/data-migration-tool/bin/migrate
.
You set it up by modifying configuration xml files in vendor/magento/data-migration-tool/etc/ce-to-ce/
folder. On supported default Magento installations, minimal required might be to configure source(M1) and trip spot(M2) database connections in config.xml:
<source>
<database host="localhost" name="magento1_db" user="root"/>
</source>
<destination>
<database host="localhost" name="magento2_db" user="root"/>
</destination>
config.xml is prime configuration file, it defines connection, which steps to execute, path to completely different explicit xmls. map.xml holds basic worldwide mapping definitions, which tables or columns to ignore, what’s renamed to what, while completely different xml files are step-specific points.
There are 3 basic directions/steps for the migration: settings, data and delta. This and their sub-steps could possibly be seen in config.xml.
cd vendor/magento/data-migration-tool/bin/
php migrate --help
Usage:
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
First, you migrate settings, web sites and retailers to M2. Most of Magento data is alleged to web sites and retailers, so this should go first.
Migrate Data
Data migration will swap classes, merchandise, purchasers, orders, wishlists, rankings, everything you presumably can think about into M2. I think about we’ll even flip off some points, like logs or quotes.
Migrate Delta
Now this is the place it can get attention-grabbing. After worthwhile data migration, you presumably can on a regular basis merely append new M1 entries to M2 database with delta migration, it will proceed the place it stopped final time. Delta doesn’t migrate new or modified merchandise or classes (at the moment of writing), solely purchasers, orders, and associated purchaser related data.
While doing data migration, set of m2_* tables are created in your M1 database with set of triggers that enables monitoring modifications.
Delta is correct right here to chop again migration time to minimal when going reside with M2.
Migrate Media
Media files can merely be copy/pasted to relevant places in M2 after merchandise and classes are migrated, straightforward as that.
Customize Migration
Since there is not a such issue as default Magento within the precise world (XD), developers will on a regular basis should configure or customise this instrument. The instrument itself is flexible, since most of mapping is printed by the use of xml files and filtered by the use of php classes, Magento crew really did good job proper right here.
Let’s say we’ve got now custom-made 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 in order so as to add following to map.xml file.
<source>
<field_rules>
<ignore>
<field>sales_flat_order.custom_column</field>
</ignore>
..
The solely remark I’ve is that presumably unknown columns should be ignored by default. If there could also be column in M1 that isn’t outlined in xml, the instrument should ignore it, it would save lot of time.
Let’s say we need to move values to renamed custom_column and modify values inside the course of:
<source>
<field_rules>
..
<transform>
<field>sales_flat_order.custom_column</field>
<handler class="MigrationHandlerAddPrefix">
<param name="prefix" value="simplemagento_"/>
</handler>
</transform>
<move>
<field>sales_flat_order.custom_column</field>
<to>sales_order.new_custom_column</to>
</move>
..
Example displays that Handler class might be utilized, or custom-made one created, for altering values on the fly all through migration.
If mapping isn’t enough, whole new custom-made step could possibly be created. Each step consists out of Integrity, Data and Volume classes. Integrity is triggered before migration to check if everything is happy with mapping, Data transfers data, Volume checks if everything is okay after migration. Delta class could possibly be added to assist delta migrations.
Conclusion
Migration instrument is good start line in M1 to M2 migration, developers can customise it and it will really save tons of labor. It’s moreover fast, as a result of it’s direct database to database migration.
At the second of writing, only one.9.1.0 was supported, nevertheless I effectively migrated default 1.9.2.0 with sample data and further tables with out many points. Other M1 variations is perhaps supported when M2 comes out.
So, most definitely data migration scenario is.. You setup empty M2 and migrate data out of your M1 web web site. You check, setup and develop everything needed in your new M2 retailer. When you’re executed and in a position to swap to M2, migrate delta, go reside.
Now, everyone knows how difficult all of this could possibly be. But, we’re proper right here that may help you with the method of Magento 2 Upgrade. Feel free to drop us a line