Hi Magento,
Is there a good way to extend Data Migration Tool?
It would be great to deal with it as with a regular Magento 2 module.
Right now, I'm copying xml.dist files to xml to adjust configurations and have all of my custom steps along with adjusted configurations under GIT control. This is not convenient, because files are under vendor/magento/data-migration-tool directory mixed with original module files.
Also, migration of the Magento takes time. This is a common case that porting starts on the one version of the system and then developers need to upgrade it during migration process. Because of upgrading Magento 2, we need to upgrade Data Migration Tool to match the version of the platform.
This leads to an issue when overridden xml files don't contain all required changes from the latest version of the Data Migration Tool. That's why I need to find that differences and merge them manually.
I will be really happy if you suggest me a convenient way of extending the Data Migration Tool module.
Looking forward to your answer.
Thanks!
Hi @roma-glushko
Here
http://devdocs.magento.com/guides/v2.3/migration/extend-the-tool.html
you can find how the tool can be extended
Also here
http://devdocs.magento.com/guides/v2.3/migration/migration-tool-upgrade.html
recommendations about updating the tool
It is a good proposal about extensions to the tool as separate modules. It would resolve issues with overridden files
Hi @victor-v-rad thank you for the answer.
So can I move all changes that are needed to be done to customize DataMigrationTool to a separated module with name, let's say, CustomDataMigrationTool?
From the second module, we would adjust everything that needs to migrate the particular webstore as it's done in other places of Magento
Right now the tool can load map files placed only within vendor/magento/data-migration-tool directory.
Internal ticket MAGETWO-90635 to allow use full path to map files in config.xml file
Meanwhile you can tweak the \Migration\Reader\Map::getRootDir() method as a temporal fix
@victor-v-rad, is internal ticket MAGETWO-90635 slated for a specific release?
@tmannherz @roma-glushko not yet. But since the tool is open-source, you can fix it and make your contribution through pull request
@victor-v-rad is MAGETWO-90635 is there any change in progress for the work to allow use full path to map files in config.xml file
@nlakhwani Please check e80bddf8c00d1ef946745acb89b5fe3538ca4eb9
Thanks @victor-v-rad that was helpful.
To modify and customize the map-eav.xml or eav-attribute-groups.xml file, one have to copy the file and place the files in the custom module as an best practice as
As of now the DataMigrationTool is not able to read map-eav.xml file if defined in a custom location for which the core code needs modification as shared by @victor-v-rad in e80bddf
I would like to share my code to override the core code for DataMigrationTool, in this case I overrided [MagentoRoot]/vendor/magento/data-migration-tool/src/Migration/Reader/Map.php and [MagentoRoot]/vendor/magento/data-migration-tool/src/Migration/Reader/Groups.php class so the script can read the xml files from the custom location, please find the attached code:
DataMigrationTool-Sample to Override.zip
Hi @tmannherz
I tried to move map-eav.xml outside magento codebase and changed config.xml accordingly. Had no error during migration
It's not nice, but you can also reference your own custom map files etc using a path relative to the vendor/magento/data-migration-tool directory. So in your example if you had vendor/roma/CustomDataMigrationTool/etc/cool-new-map.xml in your config.xml you can have
<!-- migration_config.xml -->
<config xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="../../config.xsd">
<options>
...
<map_file>../../roma/CustomDataMigrationTool/etc/cool-new-map.xml</map_file>
...
</options>
Most helpful comment
It's not nice, but you can also reference your own custom map files etc using a path relative to the
vendor/magento/data-migration-tooldirectory. So in your example if you hadvendor/roma/CustomDataMigrationTool/etc/cool-new-map.xmlin your config.xml you can have