Skip to main content

Migrating From Drupal 7 to Drupal 8

2018-12-03

If you’ve been holding out on a Drupal 8 migration, now is a good time to start thinking about taking the first steps. Drupal 8 has been around long enough for many others to have come before and to get any issues addressed, more community modules have been ported over and even Drupal Commerce has moved away from an alpha release client to a full release client.

This means that the modules that may not have been around on Drupal 8 last year, would have a much likely chance of being around now, making migrations easier now that upgrade paths are more likely to have less missing migrations.

There are a few things to take into account with a Drupal 8 migration coming from Drupal 7. The first is that views aren’t supported by default when migrating a site over, in order to do this you would need to use the View Migration community module to dump out views to yaml, which could then be imported into Drupal 8.

The next thing to think about obviously is fields that use custom modules, for instance, if you’ve got any field collections in use, you would have to migrate these over using Paragraphs, fortunately, this upgrade path has already been resolved as of early 2018 and is currently available in Paragraphs.

So certain problems that originally existed have been fixed by those who trod before. Some other considerations to take into account are things like: Fieldable Panels Panes; which has no upgrade path to Drupal 8, so you would have to resort to other methods like custom blocks etc. Using the Migrate API would be the best bet. Mini Panels; the same goes again here, there is currently no upgrade path for these. Entity Construction Kit; you will also need to think how you want to represent your existing ECK entities in Drupal 8. Currently ECK is in Alpha in Drupal 8, however, Paragraphs is a favourable alternative by some.

Custom entities created via ECK, Fieldable Panels Panes, Mini Panels etc… So depending on the complexity of your site and how many different entities, panels you are leveraging, you will have to plan your architecture and migrate a little more. For this, you have the Migrate API, which is a powerful toolkit you can use to write your own custom migrations, for instances such that you might decide to turn some custom panels into paragraphs.

Below we’ll do a simple node migration using the UI, and then we’ll do a custom entity migration to Paragraph using a custom module.For these examples, we’ll need an existing Drupal 7 site or a fresh Drupal 7 install with a custom content type set up. We’re going to need to have the following modules installed on our Drupal 7 site for this:

  • Entity API

  • Entity Reference

  • CTools

We’ll also need to install a new Drupal 8 site with a new database for it as well as enabling the Migrate, Migrate Drupal and Migrate Drupal UI modules.

Basic Node Migration

For this we’re going to run a basic node migration, this also includes a taxonomy vocabulary and two content types, one of these content types will be embedded as an entity reference in the other.

Our set up is like this, we have a taxonomy vocabulary called Categories containing; baking, business, health, home and science. We also have an Author content type and a News content type which will reference both a category and an author.

Now we go to our Drupal 8 site and go to Configuration and then Upgrade. Click continue and enter the Drupal 7 site database credentials and files directories, make sure you do a full backup of your Drupal 7 site before performing this.


 

This will give us a list of what will be upgraded, if everything looks good we can hit perform upgrade.

Once this is done, we should see the exact representation appear on the Drupal 8 end. Here are the same screenshots again but in Drupal 8 following the migration.

Summary

As you can see from this, a site using entity reference, taxonomies and content types will have a pretty good time migrating things over for the most part. There are of course things to be aware of like migrating Views over as this will require a community module, and of course, other more custom entities, especially if you have created custom fields using a custom entity type, this is where we would need to write a module leveraging the Migration API.

Look out in future for another article which will explain how to do a more complex migration using a custom module and the Migration API.