I have been running my chemistry website Yeahchemistry.com since Drupal4. I have done a number of migrations from Drupal to Joomla to Simple Machine forums back to Drupal. Then Drupal 6 to Drupal 7. I’ve even done a migration for a large homegrown road biker hobbyist community from a a homegrown php mysql platform to Drupal. All of them took a lot of patience to figure out.
Now I am ready to move Yeah Chemistry to Drupal 8. However after reading the official Drupal migration documentation and reading a number of tutorials, I found myself frustrated that none of them worked as written. So after diving into and digging the different Drupal modules that support a Drush migration and a lot of testing, I’ve decided to write my own tutorial.
We can call this, a tutorial for a Drupal 7 to Drupal 8 migration that works on this day Jan 15, 2019.
1) Download an install the following modules to your Drupal 8 site: Migrate Tools, Migrate Upgrade, Migrate Plus
If you you use composer:
composer require drupal/migrate_tools composer require drupal/migrate_upgrade composer require drupal/migrate_plus
2) With Drush or the Drupal 8 admin web interface enable all these migration modules:
- machine name: migrate
drush en migrate
- Migrate Drupal
- machine name: migrate_drupal
drush en migrate_drupal
- Migrate Plus
- machine name: migrate_plus
drush en migrate_plus
- Migrate Tools
- machine name: migrate_tools
drush en migrate_tools
- Drupal Upgrade
- machine name: migrate_upgrade
drush en migrate_upgrade
3) Next enable any core modules on your Drupal 8 site that you use on your Drupal 7 site.
4) Download and enable any contributed modules to your Drupal 8 site that you use and want to upgrade from your Drupal 7 site.
Pro tip: You don’t have to migrate and upgrade all modules as some , like Meta Tags, can be easily recreated from scratch after the upgrade. This could save you time and work.
5) Edit your settings.php on your Drupal 8 destination site by adding the following database configuration:
// Database entry for source Drupal 7 site` $databases['drupal_7']['default'] = array ( 'database' => 'd7_database_name', 'username' => 'd7_database_username', 'password' => 'd7_database_password', 'prefix' => '', 'host' => 'url to database or localhost', 'port' => '3306', 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', 'driver' => 'mysql', );
6) Navigate back to your Drupal 8 destination site’s root directory.
7) Run Drush to stage the Drupal 7 to Drupal 8 migration
drush migrate:upgrade --legacy-db-key='drupal_7' --configure-only
8) Look at all the migrations to be ran by Migration ID.
9) Methodically run each migration
drush migrate:import upgrade_d7_user_role
drush migrate:import upgrade_d7_user
You can run several migrations with one command:
drush migrate:import upgrade_user_picture_field,upgrade_user_picture_field_instance,upgrade_user_picture_entity_display,upgrade_user_picture_entity_form_display
I personally like to do these in logical grouping so I might do user first, then blocks followed by taxonomy.
I use grep to help me figure out logical groupings
drush migrate:status | grep block Import from Drupal 7 (migrate_drupal_7) upgrade_block_content_type Idle 1 0 1 Import from Drupal 7 (migrate_drupal_7) upgrade_block_content_body_field Idle 1 0 1 Import from Drupal 7 (migrate_drupal_7) upgrade_block_content_entity_display Idle 1 0 1 Import from Drupal 7 (migrate_drupal_7) upgrade_block_content_entity_form_display Idle 1 0 1 Import from Drupal 7 (migrate_drupal_7) upgrade_d7_custom_block Idle 5 0 5 Import from Drupal 7 (migrate_drupal_7) upgrade_d7_block Idle 1225 0 1225
Or if there are a lot of migration groups then:
drush migrate:status --group migrate_drupal_7 | grep block
10) Open a separate terminal window and periodically check the status of the migration step.
drush migration:status upgrade_d7_block