Drupal 7 to 8 migration on your mind? Are you still running your website on Drupal 7 (or 6)? It’s about time to migrate to Drupal 8!

We have written extensively about why you should migrate to Drupal 8 if you’re still on Drupal 7 (or 6). Although, one of our most favorite (and significant) reasons to migrate to Drupal 8 is that … Drupal 9 is coming! And if you want to enjoy the benefits of Drupal 9, it is recommended you migrate Drupal 7 to Drupal 8 first. We could argue that you should move to Drupal 8 now because there’s not enough time once Drupal 9 is here (June 2020) and Drupal 7’s EOL (Nov 2021). But you could claim that you can opt for an LTS (long term support) instead! Fair enough. Except that apart from spending more money in engaging an LTS service provider, you are also losing out on the rich benefits that Drupal 8 has to offer. Some things may seem difficult but are necessary for a stronger and simpler future.  

Once on Drupal 8, you don’t have to “migrate” anymore – only a simple “upgrade” from Drupal 8.9 to 9, and then 9.9 to 10 and so on, will do. A Drupal 7 to Drupal 8 migration is not always easy and straightforward; I agree. Following a process helps but you might still face some challenges during the migration, especially if your Drupal 7 website’s content model is considerably complex. Let’s take you through a step-by-step migration from Drupal 7 to Drupal 8 with challenges that you might face. And our recommendations on how to overcome them.

Drupal 8 Migrate – Assumptions and Preparations

To be prepared is half the victory”, said Spanish novelist Miguel De Cervantes. A Drupal 8 migrate can get complicated but if you have spent enough time in planning the migration, the challenges won’t surprise you. Drupal 8’s adoption of many modern development standards like Symfony, Twig, PHP 7, etc. has led to this complete rebuild but it also calls for more powerful, robust and flexible digital experiences. Listed out are a few pre-conditions that you should remember before you begin the Drupal 7 to 8 migration–

  • Update your Drupal 7 website to the latest version available. This will help in cleaner automatic upgrades of some of the modules that have direct Drupal 8 upgrade paths.
  • Make sure you have access to the Drupal 7 website’s database and files (public and private).
  • Create a backup of the Drupal 7 website and use this backup for the Drupal 8 migration. It is not recommended to migrate a live functional website although the migration itself does not make any modifications to the source.
  • Download a fresh installation of Drupal 8 from here and enable the core Migrate modules the we discussed above. And remember, it MUST be fresh! Any configurations made or content created will be overwritten when a Drupal 8 upgrade is performed.
  • There is no direct upgrade path from Drupal 7 to Drupal 8 (unlike in previous version upgrades). Familiarize yourself with Drupal 8’s migration system. The three modules that are in core –Drupal 8 Migrate module, Drupal 8 Migrate Drupal module and Drupal 8 Migrate Drupal UI module. 
  • Make your migration choice – will you use Drush (which gives you granular control) or will you go with the browser user interface (easier but less control)?
  • Know your source. The Drupal content migration system’s flexibility allows content to be extracted and loaded from older versions of Drupal and various other sources like CSV, XML, JSON, MYSQL, etc.
  • For a smooth Drupal content migration, perform a thorough content audit to identify content that you need to migrate. Discard unused and irrelevant content to avoid spending time and effort in migrating them.

The Drupal 7 to 8 Migration Process (Step by Step)

  • Observe and Plan

A smooth Drupal content migration requires you to first Identify the content types and content structure of the existing site and document the observations. This includes content types, field types, blocks, taxonomies, etc. Prepare a plan on what you need to migrate and what needs to be merged, based on these observations. Analyze the views and other site configurations and catalog them so it is easier to replicate them in Drupal 8. 

  • Create a modules checklist of your Drupal 7 website

With this checklist you should be able to identify modules that you still need, or if there is a Drupal 8 version of that module, or if the module has now moved to Drupal 8 Core (like the Media module). Not all Drupal 7 modules can be automatically migrated to Drupal 8. Some Drupal 7 modules may have merged their functionality into a single Drupal 8 module. And some Drupal 7 modules may have separated their features into two or more Drupal 8 modules. It is always better to analyze such cases to be sure there is no data loss!

     Expert Recommendation – Use a module like the Drupal Migrate UI to identify the Drupal 7 modules and their corresponding Drupal 8 module (if available or not).

drupal-7-to-8-migration

Pro Tip - No module version available for Drupal 8? For example, the ImageField module in Drupal 7 does not have a corresponding D8 module. We might have to find best suitable alternative available for this in Drupal 8. Of course, we have the Drupal 8 core Media module. However, we will have to develop custom scripts to migrate the image data. migrate the image data.

Expert Recommendation – If you have just inherited a D7 website and have no idea about the customizations made to the modules OR If you have made customizations yourself and need to find them, we recommend you to use the Hacked! module. This module will go through the list of modules available on the site and the changes/customizations done to each module. 

  • Replicate and Build
    Replicate the content types, taxonomies and all the entities that are required in your D8 instance. Views must be built manually once you have the contents created and replicated. 

Expert Recommendations – 

  1. Template files(.tpl) in Drupal 7 should be written rewritten using twig files, which is part of symphony 2 framework.
  2. Make sure you rewrite your custom modules that follow symphony standards.
  • Implementing the Drupal 7 to 8 Migration 

The most awaited and significant step has arrived. As discussed earlier, there are two ways of migrating your Drupal 7 data to Drupal 8 -

  1. Running a migration with the Drupal UI
  2. Running a migration with the Drush

The latter is recommended as it is more efficient, can be incorporated into shell scripts, and has clearer error messages. 

Drupal UI Method

Leveraging the Migrate UI Drupal 8 module, you can start by visiting the /upgrade path of the Drupal 8 website. The Drupal 8 upgrade review page will show you a list of modules in your Drupal 7 site that can and cannot be automatically migrated to Drupal 8. For modules that have their functionalities in another D8 module but not exactly the same (like the AddressField module in D7 is now Address module in D8), you will need to install and enable the corresponding D8 module and restart the Drupal 7 to 8 migration process. Based on the catalog of the content and the extracted data you need to build the migration scripts where you map the content type attributes of Drupal 7 with the newly built content type attributes of Drupal 8. Next you can go ahead with importing the data from a data source.

Drush Method 

Are you comfortable using terminal? If so, you should opt for the Drush method for the Drupal 7 to 8 migration. It provides a set of commands for the process of data migration with better status messages. Check out this tutorial if you’re looking for a step by step procedure migration using Drush commands. Never used Drush before? This guide will help you understand the basics of Drush with a list of useful commands for migration.

You might run into some conflicts now. Make sure you have checked for known issues in Drupal . org and how to fix them. Once fixed, you can now run the Migration process that gives continuous logs/feedback of the actions taken. Lastly, check the logs for any errors, fix them and you are good to go!

Expert Recommendation – Wait! Once you have the content created, never overlook the SEO/page views. We need the content to have the same URL paths. Do not forget to take care of migrating the URL aliases, meta tags information of the content from the old Drupal 7 site.

  • Testing

There are very rare times when you would run into zero issues during a Drupal 7 to Drupal 8 migrate. Once the migration is completed, a regression testing of the configuration and content freshly imported to identify any potential bugs or issues is absolutely necessary.

Challenges and (more Expert) Recommendations

  • Many Drupal 7 contributed modules have better versions of themselves in Drupal 8 and some have been deprecated. For example, the Field Collection module, which is used for grouping fields in Drupal 7 is soon to be deprecated. This module’s functionality has been added to the Paragraphs module and Entity Reference Revision module in Drupal 8. The Drupal 8 Paragraphs module provides immense flexibility to Content editors/authors to create seamless forms and structures. If you need to migrate the Field Collection module and map it to the Paragraphs module (D8), you will need to write custom plugins to map the content between Field Collection fields to Paragraph fields. Or if you still want to continue migrating the Field Collection module even in Drupal 8, this field mapping can be handled by available Core migrate plugins. 
  • Do you use Panels for creating your landing pages like Home page, Dashboard, etc.? Even if you only need to place a block in the home page? Layout builder to the rescue! Layout Builder in Drupal 8 makes it easier for a content editor to customize a landing page. Let’s make best use of the features of Drupal 8. To migrate from Panels to Layout builder, you will need to write some custom migration plugins.
  • While migrating users, we will have to maintain the passwords as well so that the user does not have to recreate the password on the new site. Passwords are hashed content. So, you must find the hash type algorithm that is used in the source site. Next. write a process to validate the migrated password with the rehashed password using the same algorithm.
  • When running a Drupal 7 to 8 migration, you may exhaust your system resources which may cause your migration to stop. Thanks to highwater marks, you can run the migration again and it should pick up from where it left off.
  • The widely used Features module in Drupal 7 now has almost become obsolete after the Configuration Management took over all the Features functionality and more in Drupal 8. Although the Features module is available in Drupal 8 as well, it is highly recommended to leverage Drupal 8’s Configuration Management system. It is not only simpler to work with, it is easy to export between environments, it uses YAML file formats instead of PHP – which is a more readable and proper data format.
  • If you have a multilingual Drupal 7 (or 6) website, you can leverage the Migrate Drupal Multilingual module. Although, the Migrate Drupal multilingual module is still in an experimental stage, it is a must-have module for all multilungual Drupal sites.
  • Facing problems with your Drupal 7 to Drupal 8 migration? There are several ways to report failures and get help -

        - Drupal 8 Upgrade Issue Queue

        - Module issue queue if you find a bug or exception with a core/contributed module

        - The #drupal-migrate IRC channel on Freenode

        - The #migration channel on Drupal Slack

        - Hire a Drupal Expert

 

Harika AND ShefaliFeb 27, 2020