Migrating Content into Drupal 8

Note: Updated for Drupal 8.2!

Drupal 8 includes a powerful built-in migration system for importing content into your site. It is designed to handle data from Drupal 6 or 7, and much more. It is built around a plugin-based architecture, which allows importing of data from any external data source if you write your own source plugin.

History

When Drupal 7 was released, it came with an upgrade script that would convert a Drupal 6 database into a Drupal 7 database. For Drupal 8, the core team decided against this approach, in favor of creating a more flexible migration module.

The Drupal 7 migration infrastructure expanded with the release of the Migrate and Migrate D2D contrib modules, used for importing data from various data sources, including Drupal 6. In Drupal 8, the Migrate module is in Core. It is listed as experimental and features may change between minor releases.

The team developing the Migrate modules maintains a group on Drupal.org. For more information about the status of these modules, visit the IMP project on Drupal.org.

Migrations in Core

Drupal 8 includes two core modules:

Migrate - A base module for creating your own custom migrations. This module provides the core migration architecture, but does not define any usable migrations itself.

Migrate Drupal, a module containing migration definitions and source plugins for migrating content from Drupal 6 to Drupal 8. This will eventually support Drupal 7 as well.

Other components

In addition to the core modules above, there are several contrib modules designed to enhance the migration workflow. As of Drupal 8.2, these remain in contrib space and have not been added to Core.

The Migrate Plus module provides support for grouping of migrations, and also some handy examples of migration plugins and configuration. It is a dependency for the code samples below.

The Migrate Tools module provides Drush integration for running migrations from the command line.

The Migrate Upgrade module provides Drush integration for importing data from Drupal 6 and 7.

Using the built-in migrations from Drupal 6 or 7

The migration plugins built into Migrate Drupal and Migrate Upgrade can handle a migration of a Drupal 6 or 7 site to Drupal 8. The documentation for Migrate Upgrade contains instructions for using this feature.

Writing a custom migration

The built-in migrations are fine for many use cases, but you might find yourself needing to write a custom migration. If you are migrating from a different data source, be it WordPress, a CSV file, or a spreadsheet, you can write your own migrations. Or, if you are the maintainer of a contrib module that provides its own custom entity type, you could write a migration for this entity as well, so that users of your module could upgrade from the 7.x to the 8.x version.

For an example of writing a custom migration from Drupal 7 to Drupal 8, see the next installment in this series, Migrating Users from Drupal 7.

Filed under 

every body is talking about the Database(Content ) migration from drupal 6/7 to 8. what about the code migration/upgrade/update/? I have drupal 7.34 project with 100 contrib modules and custom templates(No TWIG),how can i make this code working with drupal 8 core system(which is symfony)

If you're looking for a way to upgrade your custom modules, you can try the Drupal Module Upgrader contrib module, which is designed to help convert Drupal 7 modules to Drupal 8.

I'll caution you that moving a Drupal 7 site to Drupal 8 is going to be a major undertaking. Tools like Migrate and Drupal Module Updater can help, but there's nothing that's going to make it be 100% painless.

Hi Jonathan,As the hosted onipots from Microsoft are free (or considerably cheaper) compared to on-premise installations, then we have taken the view to support these first as one would expect most schools to make the most of those savings. Local Exchange support is something under consideration but has not been prioritised as it stands today. We'll see what the uptake of the cloud-based variants are like first and then take a decision from there.

Hello,

Thank you for the drupal upgrade module information but do we really need to use drush ?

No easier way ?

Thank you.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.

About the Author

Keith Dechant, Software Architect

Keith has been working on the web almost since it was new, writing his first HTML in 1996 and his first PHP code in 1999. Along the way, he has written everything from e-commerce websites to mailing list software to large web applications for industrial and non-profit organizations. Recently, he has done a lot of work with ASP.NET, Django, Drupal 7 and 8, and AngularJS.

Keith is a native of Illinois who moved to Portland in 2009. He has been to 49 US states, five continents, three former Soviet republics, and two countries that no longer exist. He likes hiking, mountain climbing, classic video games, and the Oxford comma.