Migrations are becoming a crucial part of Drupal 8, especially in connection with the upcoming Drupal 6 EOL. In this first article, we are going to show you how to quickly migrate your site to Drupal 8.
What core provides
In Drupal 8, Migrate API became part of Drupal core. Let’s find out what it provides.
After you install Drupal, go to the Manage > Extend section and type “Migrate” into the search box. You should find two results - Migrate and Migrate Drupal.
As you can see, both modules are in core but are marked as experimental. This is because of some missing parts, we will get to those shortly.
The Migrate module provides API itself, and you can use it to migrate almost any other DB source into Drupal. The Migrate Drupal module provides special configuration for migrating older versions of Drupal to the latest version, Drupal 8. After you enable both modules, you won’t notice any changes in the admin zone, except for new help items. Modules provide API and framework for building migrations, but unfortunately they don’t provide any UI. Strangely, they also don’t provide any Drush commands, so basically you have a framework but you don’t have any way to run it. The solution to this is in Drupal Console, a new Drupal 8 CLI tool that provides three commands for working with migrations.
Another solution is to use one of the contrib modules. Currently, there are three modules that provide UI and/or Drush commands. All of these modules depend on the Migrate Plus module. This module extends core migrate with a new event or entity, and also provides some additional modules for different migration sources, like JSON, CSV or XML.
Migrate Upgrade is a simplified version of the Migrate Tools module. It provides basic migration of UI and only two Drush commands without the possibility of rollback. An interesting fact about the Migrate Upgrade and Migrate Tools modules is that both are supported by Acquia. I recommend this module if you want to rely on UI. When you go to the /upgrade page, you get the same instructions as on the update page.
On the next page, you are asked for DB credentials for the old database and the path to files directory. The good news is that the path to files can be a URL, so Drupal 8 will download files directly from your live D6/D7 site.
After you click on Review, you are taken to a page where you can review all missing and available migrations and decide if you are going to proceed with migration or not.
Some blogs and d.o issues say that it is not possible to migrate Views from D6 to D8, but this issue is only related to Views-6.x-2.x. First you are required to run migration from Views 6.x-2x. to Views 6.x-3.x, which contains a bug that is currently being fixed.
For my testing site, migration took ~15 minutes. All blocks, even custom ones, were properly migrated and placed on the page. I was surprised to see that the migration of the content types failed because of missing dependencies, and it didn’t try to run the migration again after the dependencies were migrated.
This is probably the best option for basic migration functionality from Drush. After you install this module, you will get a UI that shows existing migrations and six Drush commands. This module is also the only one which provides rollback functionality.
After you install it, go to Manage > Structure > Migrate (/admin/structure/migrate), where you can see available migration groups. For the module to work correctly, you need to define a new DB connection called migrate, otherwise you will get WSOD after you click the List migrations button.
Manifest was an older way of running migrations in alpha and early-beta phases of Drupal 8 development. It allowed you to select which core migration templates you wanted to run. The Migrate Manifest module doesn’t provide any UI, only two Drush commands - one for running migrations and the other for listing available migrations.
In conclusion, I would like to say that the migration path from D6 to D8 is quite stable for single language sites, but I would say that most sites running on D6 now will require a complete rebuild anyway. Migrations from D7 to D8 are under development, but seem promising. You can watch its progress here.
In the second part of our series we show you how to alter default migration for your needs.