Development

Jun 18. 2020

Upgrading Drupal 8 to Drupal 9: The real-world experience

drupal 9

We have discussed prerequisites and changes in following article: 
Drupal 9 is coming!

........

To make things as simple as possible, we used Composer and Drush. This is the modern way of doing Drupal using terminal.

First of all, we dumped database to have a backup. Just in case.

To start, we had to upgrade to latest version of Drupal core and modules in 8.x family. In our case it was Drupal 8.9.0. We changed composer.json file and ran update scripts.


"require": {
    "drupal/core": "^8.9.0",
},
"require-dev": {
    "drupal/core-dev": "^8.9.0"
}

Above are lines changed in composer.json.


composer update drupal/core drupal/core-dev --with-dependencies
composer update
drush updatedb
drush cache:rebuild

After that we installed and enabled Upgrade Status module. This is handy tool to check readiness for upgrade. In fact, this module saved our web and a lot of troubles.


composer require --dev 'drupal/upgrade_status:^2.0'
drush en upgrade_status
drush cache:rebuild

After that, we were ready to see how ready we are for the next major version of Drupal. We were not. PHP version was the only green thing in the list. Since it is an older web, we had to upgrade MySQL version (MariaDB in our case) and upgrade Drush version.

drupal system readiness for upgrade
Drupal system readiness for upgrade


So we did. Docker helped us with database and Composer helped with Drush.


composer require 'drush/drush:^10.0'

With system ready, we were ready to check all modules and themes, both custom and contrib. So we selected all checkmarks and pressed “Scan selected”. We ran into timeout after 60 seconds. And again, and again. We had to change the attitude. We used Drush one more.


drush upgrade_status:analyze --all

Status Upgrade terminal output
Status Upgrade terminal output


We were luckier this time. Whole script passed and we had our results. In a loooong console output. Luckily, all the data could be displayed in Drupal admin zone too.

Status upgrade warning for custom theme
Status Upgrade warning for custom theme


Custom modules and theme needed only cosmetic fix. To add core_version_requirement into info file. It tells Drupal core that it can be used with Drupal core 8 and 9. But contrib modules gave us headache. Lot of them using deprecated methods even in the latest versions. Lot of them generating warnings and errors. In that very moment we knew that Drupal 9 is no go for us yet. It is not so surprising since we have tested it mere days after Drupal 9.0.0 release, but it was still a disappointment.

status upgrade in drupal admin UI
Status Upgrade in Drupal admin UI

 

deailed drupal 9 incompatibility output
Detailed Drupal 9 incompatibility output


Some of the modules had new alpha or beta releases ready. For most modules it is not what you want to use. For some, it is unfortunately the only release. Some did not have even beta releases ready for Drupal 9.

In the end, result of upgrading from Drupal 8.8 to 9.0 was upgrade to 8.9. Without any problems. It’s also something. Upgrading to Drupal core .0 versions is usually not without problems in bigger systems.

We have to wait for modules to be ready for Drupal 9 and maybe we will be forced to replace some of them one day.

Viktor

Viktor Šulák

Partner, Lead Backend Developer

Tags: