Migrating Drupal 8 in Europe

Ryan Weal

September 28, 2014

photo of the sprint room at drupalcon extended sprints

This week we're in Europe for DrupalCon Amsterdam! This is starting to feel suspiciously close to a beta so it is time to dive into Migrate again so you can start working on your new sites with real-world data. Let's begin!

What's up with migrate?

Migrate in the Drupal context means running a migration from the new Drupal 8 site and pulling data from an existing site. It replaces the old upgrade-in-place system that was used in prior versoins of Drupal. So do a fresh install of Drupal 8 and have an old Drupal 6 site on the same host. After you've logged into Drupal 8 you can connect to your Drupal 6 site.

How is Drupal 8 migrate different from Drupal 7 migrate (and migrate_d2d)?

In the older versions of Migrate the process invovled defining your field mappings and manually creating the new content types in the D7 system. This is no longer necessary. Drupal 8 migrations will automatically create the needed content types and establish the mappings between the old and new fields by default. Therefore much less configuration is needed. For times when it is necessary to customizae your migration you can use the included hooks or you can use the configuration schema to use the included plugins with your custom data set. The hooks go further than in D7, allowing you to alter data in the prepareRow stage without having to create a custom migration to deal with the data.

Migrate from Drupal 6? What about from Drupal 7?

Migrate frees us from the need to update each sequential version. You can leafrog versions! With Drupal 6 being close to end-of-life it is important to have a pathway for these users. For this reason, the D6 to D8 path was built first. For Drupal 7: soon. This is now in-progress now that we are finalizing the Drupal 6 code.

Requirements

Using Drupal Tools If you do not currently have a Drupal 8 install one route to get there is to use the

[Drupal Tools][4] for your platform. It includes all the software you need and the correct versions. It is available for Linux, Mac, and Windows. If you install the Drupal Tools package it is not necessary to install Git, Drush, or Composer. The installation should be current as it includes a version of Drush which must be up-to-date. So if you had installed Tools before, double check the version if you have any trouble. 

Install Drupal8 Using the database credentials you created, install your new Drupal 8 site. If you need to rebuild your site remember to delete your ENTIRE files folder and old settings.php. Reinstalling without doing this step will cause problems. 

Install Composer / Drush Make sure you have run the Composer installer. You should be able to type 

`which composer` and get a result in your terminal. Check out the latest Drush. Go into the Drush folder and run `composer install`. Next time you `git pull` (or `git fetch`) in the Drush folder, make sure to run `composer update`. 
### Find an isuse to test

*   Go to the Drupal project issue queue and [filter down by Component: migration system, Version: 8.x][5].
*   Pick an issue that is not already fixed.
*   If you are sprinting with lots of people, pick something further down the list so you are not working on the same thing as someone else.
*   Read the posts. If it is easy enough you think you can handle it, post a comment to say you are doing some work on it.
*   Post the results of your tests.
### Time to Migrate Put the manifest.yml file with the migrations you wish to run in your D8 site root. Then go there on the command line and run the following command, using your D6 database credentials. You can install Drupal 8 at this stage. If you do, be sure to enable all of the necessary modules. For example, if you use the Book module, it is not enabled by default, so you should enable it now or your book nodes will simply become a regular content type. When Drupal 8 is no longer in beta the manifest.yml file will not be necessary unless you are doing some custom work. In most cases all that will be necessary is to put in the database credentials and the system will run all the migrations that the system knows about by default. You will find a manifest.yml file attached to many Migrate issues that will enable you to begin the migration. Here is a sample of what I am using... I have added together many different issues and I run them all at the same time: 

*To get the complete list of available migrations run **drush config-list|grep migrate*** `# user