Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Download & setup both the D7 and the D8 sites.
  2. Do the following in your terminal on your D8 site (change our YOUR-MODULE as need be):

    Code Block
    vagrant@dvm:/var/www/YOUR-SITE/web$ drupal gm
    
     // Welcome to the Drupal module generator
    
     Enter the new module name:
     > YOUR-MODULE Migrate
    
     Enter the module machine name [YOUR-MODULE_migrate]:
     > 
    
     Enter the module Path [/modules/custom]:
     > 
    
     Enter module description [My Awesome Module]:
     > The Migrate Template for YOUR-MODULE
    
     Enter package name [Custom]:
     > YOUR-MODULE
    
     Enter Drupal Core version [8.x]:
     > 
    
     Do you want to generate a .module file (yes/no) [yes]:
     > no
    
     Define module as feature (yes/no) [no]:
     > 
    
     Do you want to add a composer.json file to your module (yes/no) [yes]:
     > 
    
     Would you like to add module dependencies (yes/no) [no]:
     > yes
    
     Module dependencies separated by commas (i.e. context, panels):
     > migrate_drupal, migrate_plus, migrate_tools, migrate_upgrade
    
     Do you want to generate a unit test class (yes/no) [yes]:
     > no
    
     Do you want to generate a themeable template (yes/no) [yes]:
     > no
    
    
     Do you confirm generation? (yes/no) [yes]:
     > yes
    
                                                                                                                                                                                                     
    Generated or updated files
    
     1 - /var/www/YOUR-SITE/web/modules/custom/YOUR-MODULE_migrate/YOUR-MODULE_migrate.info.yml
     2 - /var/www/YOUR-SITE/web/modules/custom/YOUR-MODULE_migrate/composer.json
    
    
    
  3. In your settings.local.php add this to the top:

    Code Block
    $databases['migrate']['default'] = array (
      'database' => 'DRUPAL-7-SITE_drupalvm',
      'username' => 'drupal',
      'password' => 'drupal',
      'prefix' => '',
      'host' => 'localhost',
      'port' => '',
      'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
      'driver' => 'mysql',
    );
  4. In the YOUR-MODULE_migrate module we created above, add a config/install folder

  5. In your D8 site run this:

    Code Block
    drush config-export --destination=/tmp/migrate
    cp /tmp/migrate/migrate_plus.migration.* /path/to/YOUR-MODULE_migrate/config/install
    cd /path/to/YOUR-MODULE_migrate/config/install
  6. Then you can go through and remove the yml files you don't need.  Careful though, read the required dependencies at the bottom of each yml file.
  7. Wipe and re-install your D8 site and you should only have the config you specified in the module now.
    1. Use drush migrate-status to check
  8. If you need to skip rows (ie fields, certain nodes, etc), this is a good tutorial on how to do so: https://drupalize.me/tutorial/use-hookmigratepreparerow?p=2578
  9. Wipe and re-install your D8 site plus enable the cusotm moudle. You should only have the config you specified in the module now.

    1. You can check and then import with:

      Code Block
      drush migrate-status
      drush migrate-import --all