General Overview
There are a lot of good articles out there that can help you with this. This is more of specific examples on how to do it between 2 localhosts.
Some references:
Preparing for an Upgrade (READ FIRST)
UI Based Migration
Simple, but will write this up later. In the interim: https://drupalize.me/tutorial/drupal-drupal-migration-ui?p=2578 check that out
Migrating with Drush
You will need a few extra modules to get started with this route: Migrate Tools, Migrate Upgrade & Migrate Plus
- Read the module page to make sure you grab the appropriate version for your D8 core version.
Double check if you need any special modules for your content as mentioned in the Preparing for an Upgrade link above.
Kalabox
Currently can't enable Migrate Upgrade module - see issue: https://github.com/kalabox/kalabox/issues/1789
Drupal VM
- Download & setup both the D7 and the D8 sites
- Enable the migrate, migrate tools, migrate upgrade & migrate plus modules in the D8 site
In the D8 site run this
drush migrate-upgrade --legacy-db-url=mysql://drupal:drupal@localhost/D7SITE_drupalvm --legacy-root=http://D7SITE.dvm --configure-only drush migrate-status
- You will see a list of all the items queued for migration. You can either migrate them all or pick and chose.
You can migrate all of the items with:
drush migrate-import --all
OR you can be more granular and migrate only certain items:
drush migrate-import {migration name} i.e. drush migrate-import upgrade_d7_menu drush migrate-import upgrade_d7_node_news
- NOTE: it will tell you what other items you need to migrate with that singular migration peice when you try to import it.
Custom Migrations
Use this option if you need to be more granular in your migration. You can also use this to change the names of items, etc. There are a lot of great resources out there on how to do super duper custom configs. This is just a simple example.
Drupal VM
- Download & setup both the D7 and the D8 sites.
Do the following in your terminal on your D8 site (change our YOUR-MODULE as need be):
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
Run this in the D8 site:
drush migrate-upgrade --legacy-db-url=mysql://drupal:drupal@localhost/D7SITE_drupalvm --legacy-root=http://D7SITE.dvm --configure-only drush config-export --destination=/tmp/migrate
- In the YOUR-MODULE_migrate module we created above, add a config/install folder.
Run this:
cp /tmp/migrate/migrate_plus.migration.* /path/to/YOUR-MODULE_migrate/config/install cd /path/to/YOUR-MODULE_migrate/config/install rename s/"migrate_plus"/"YOUR-MODULE_migrate"/g *
- 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.
- Wipe and re-install your D8 site and you should only have the config you specified in the module now.
- Use drush migrate-status to check
- 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