0

I have done default migration using Data Migration Tool. Now I want to migrate data of my custom module for that I am following below link:

https://devdocs.magento.com/guides/v2.4/migration/extend-the-tool.html

But, How can I run migrate:data command only for my custom module, As I don't want the command remigrate all data like customers, products, orders etc.

Let me know how can I run it for my custom modules only.

1

You can have a different configuration file for your entities only. In the link you referenced there is a section that explains how to create the migration configuration for a custom entity: https://devdocs.magento.com/guides/v2.4/migration/extend-the-tool.html#create-a-custom-step

It says to create a section in the config.xml file that you are using, but you can actually create a separate config file with just your entities. Following the example in the docs, your new config file can be called blog_migration_config.xml and it can looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
        xs:noNamespaceSchemaLocation="urn:magento:module:Magento_DataMigrationTool:etc/config.xsd">
    <steps mode="data">
        <step title="GreatBlog Step">
            <integrity>Vendor\Migration\Step\GreatBlog\Integrity</integrity>
            <data>Vendor\Migration\Step\GreatBlog\Data</data>
            <volume>Vendor\Migration\Step\GreatBlog\Volume</volume>
         </step>
    </steps>
    <steps mode="delta">
        <step title="GreatBlog Step">
            <delta>Vendor\Migration\Step\GreatBlog\Delta</delta>
            <volume>Vendor\Migration\Step\GreatBlog\Volume</volume>
        </step>
    </steps>
    <source>
        <database host="..." name="...." user="...." />
    </source>
    <destination>
        <database host="...." name="...." user="...." password="..." />
    </destination>
    <options>
        <greatblog_map_file>app/code/Vendor/Migration/etc/opensource-to-opensource/map-greatblog.xml</greatblog_map_file>
    </options>
</config>

Create your map-greatblog.xml file also to map your data structure from magento 1 to magento 2 following the guidelines in the docs.

and you can run the migration command with your config file

bin/magento migrate:data [-r|--reset] [-a|--auto] {}

6
  • Thank you. I have run below command for my custom data migration php bin/magento migrate:data -a "app/code/Project/Migration/etc/opensource-to-opensource/1.9.2.4/blog_migration_config.xml" --reset Got below error: In Map.php line 92: XML file is invalid. – Yogita Apr 13 at 8:14
  • I have added steps like <integrity>Project\Migration\Step\GreatBlog\Integrity</integrity> I replaced the Vendor with Custom namespace that I am created while overriding config.xml & map.xml for data migration tool as the blog_migration_config.xml and all other files also reside into this module. Is I am doing anything wrong? – Yogita Apr 13 at 8:31
  • I have not added any map.xml file path in options of my custom config.xml file, then why the map.php file error? – Yogita Apr 13 at 15:52
  • Do I need to add custom map.xml or class-map.xml files – Yogita Apr 14 at 17:19
  • I donțt remember exactly, but the basic idea would be to start from the original config.xml file, add your own config as recommended and then remove the core steps – Marius Apr 14 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.