How and When to Plan for Drupal 7 to Drupal 9 Migration
Drupal has long been the CMS of choice for big brands with heavier websites. Apart from Mint, Tesla, Taboola, Box, etc., Drupal is used by more than a million websites globally. Drupal is also known for its periodic upgrades that allow developers to take advantage of next-generation technologies and enhance the user experience of websites.
Drupal 7 is a popular version and continues to be in use across several websites. However, there has been a steady move towards Drupal 8. With the imminent end of life of Drupal 7 by November 2022, brands must switch from Drupal 7 to Drupal 9 as quickly as possible. Many of you may be wondering about the potential pitfalls of this upgrade. We will discuss the smoothness of the upgrade and more in this article.
The Ideal Way for Migration from Drupal 7 to Drupal 9
When you have planned to migrate your website from Drupal 7 to Drupal 9, you must ideally finish before the Drupal 7 version reaches the end of life. The ideal path would be to migrate through Drupal 8. The updating through a late version of Drupal 8 is easier because you would not need the considerable effort required in older Drupal migrations. It helps to do the heavier migration to Drupal 8 right away, while the more straightforward upgrade to Drupal 9 can happen in due course.
A number of contributed modules in Drupal 7 are now part of the core modules in Drupal 8. Most of these modules come with migration scripts to help developers understand the prerequisites and workflow for migrating the content & configuration managed by the modules.
One can follow either of the two paths for migrating a D7 project to Drupal 9:
- You can migrate everything into an empty Drupal installation; or,
- You may build a new Drupal 8 site while setting the fields and content type basis your needs. You can then migrate the Drupal 7 content into it.
Developing the Migration Strategy
Organizing the architecture for the source & destination sites is key to planning the migration and it sure can be a hefty task. But one can rely on a Migration planner to assist with this migration strategy. It will query the database and create an Excel file that can be used to plan the migration. Some capabilities of the core can allow migrating the content automatically. It will be possible if the site is limited to the core and the standard contributed content fields and types. But if the site relies too much on custom code, you must utilise a custom migration approach.
Several modules can act as the ideal starting point for a custom migration. You can also add Drush support for some of the non-core fields. There are custom migration processors, and you may add some lines into a YAML file and do a lookup to ensure what Drupal 8 entity it will refer. While migrating from older Drupal 7 versions, you must be careful to investigate all platform requirements.
Preparation For Migrating Through Drupal 8
Undertaking the migration from Drupal 7 to Drupal 9 through Drupal 8 involves a lot of preparation and there are a few preliminary steps that should be taken during this phase.
- The Drupal 7 project must be up-to-date in every aspect that means the core should be updated to the latest version along with the extensions. A lot of these provide features to assist with the migration process and can reduce huge amounts of effort.
- This is a given but the site should always have a backup.
- The fresh installation for the Drupal 8 site ought to be the latest stable version with the Migrate modules enabled.
The Detailed Process of Migrating to Drupal 8
To ensure a smooth migration of the content, you must first identify the content structure and the content types of the current site and write down the observations. Accordingly, you must create a migration plan while analysing the possible site configurations. It will help in easier replication in Drupal 8.
It is also necessary that you identify the modules that you need to migrate to Drupal 8. It is essential as some of the Drupal 7 modules may have merged. It may also happen that some of the features in older modules may have been broken down into different modules.
- The Drupal UI Method
You can use the Migrate UI Drupal 8 module and visit the /upgrade path of the website. The review will list out the modules that cannot be migrated automatically to Drupal 8. Some modules are not the same; you must install and enable the corresponding Drupal 8 module. The migration process must then be restarted.
The migration scripts will be built based on the extracted data and the catalogue of the content. The content types attributed to the earlier version must be mapped to those in Drupal 8. Now you can import the data from a data source.
- The Drush Method
This method sets forth a set of commands for the data migration exercise with improved status messages. For this method, you must use these contributed modules, viz. Migrate Upgrade, Migrate Plus and Migrate Tools. You must define the database connection details for the source website. Next, connect it to the local development database and the source database. The Drupal 7 database must then be imported.
The Migrate Tools module is a contributed one, and you can add Drush commands.
The individual migration must be created first based on the source database. The Drush migrate-upgrade command can generate the migration you will need. You can use a manifest file and set up a specified set of migration. The Migrate Manifest module will be required. The migration can be listed in any order but can be executed based on the dependencies.
Onwards upgradation to Drupal 9
Before you upgrade to Drupal 9, always ensure that the site is upgraded to Drupal 8. You must also update the contributed modules along with the themes to Drupal 9. You must find out the contributed modules that you need and what can be done to upgrade them to Drupal 9. Maybe a patch is available, and the community needs to test it.
If the project has custom themes or modules, the code must be made compatible with Drupal 9. The Upgrade Status can be used for scanning, and the deprecated APIs must be removed. Also, the Drupal 8 project must be using Composer to manage the dependencies.
Planning for the Migration to Drupal 9
While the Drupal 7 to Drupal 9 migration is needed, you must plan the activities well to ensure a smooth transition. Three main factors can affect migration activity.
- The skillset of the Team
One of the critical factors to consider for the migration exercise is the skillset of your team. Did your team upgrade their skills with the newer versions of Drupal? If they did, then you can expect the migration to be carried out smoothly. Composers can make work easy for the team, but they must also be capable of using it. There have been significant improvements over the various versions.
It becomes that your developers upgrade themselves with the later versions of Drupal to ensure that the migration to Drupal 9 is a breeze! If they are yet to come to speed, you must factor in the resources to be consumed into your budget for the migration. Taking the services of an external agency can be helpful, but only if they can understand your business workflows. Also, you must consider their prior experience in similar migration projects.
- Consider the Resources Involved
You must plan out such humongous activities well in advance. One of them is having a budget allocated for this activity. If you plan the migration with a detour through the Drupal 8 route, you must plan to have two separate sub-activities. You may go for a phased upgrade if you are short of resources.
The team must have an overview of the process involved in upgrading from Drupal 7 to Drupal 9. You can consider various factors like your current business goals and objectives or whether the feature requirements for the content editors have changed. Also, check the design aspects – whether your website needs a change and create a great user experience. Before going for the upgrade, check your website design and whether it is in sync with your overall website strategies.
- Check any Feature Update that you will Need
Before finalizing the migration process, always undertake a comprehensive audit of the Drupal 7 site. Check whether there are any content types that you can remove. Probably the site is using a taxonomy that went defunct long back. You may merge different content types when you upgrade to Drupal 9. There could be a requirement to migrate content from a deprecated Drupal 7 field to an upgraded Drupal 9.
If you have mothballed the site for some time, you may need to check the additional features you need on the site. Ideally, you will now need a dynamic front-end that will help to connect with the visitors better. The newer Drupal 9 has a WYSIWYG editor that will remove the need for several contributed modules. Undertake a thorough check whether the site needs a rigorous design check as there are several improved themes in Drupal 9 that you can use.
- Plan the migration activities
While the migration activities may be relatively easy than the earlier versions, you must plan the activities properly. Also, generate the migration files and set up a backup of the site for running migration. You may also do cleaning up if needed. If you are undertaking a phased migration through Drupal 8, always keep in mind that the upgrade to Drupal 9 requires Drupal 8.8.x or 8.9.x versions.
It is necessary to ensure that you undertake a migration of your site from Drupal 7 to Drupal 9. It is suggested that you launch a phased approach and first migrate the site to Drupal 8. You must have a proper migration plan and ensure that only experienced developers are on your team. You may also take the help of professional migration services providers.