Categories

Using Drush for your Drupal website upgrade

01.04.2016
Using Drush for your Drupal website upgrade
Author:

Drush is a great help when it comes to dealing with Drupal websites. This famous command-line tool offers a lot of useful commands for operating with modules, themes, profiles and much more. They are meant to make a developer’s life much easier.

Today, we’ll discuss how to use Drush if you want to upgrade your Drupal website from version 6 or 7 to 8. Drush will save you a lot of time and effort.

Update your Drush

First of all, you need to have the latest version of Drush. Check your Drush version with the drush --version command. You can download the latest version of Drush, for example, at GitHub. Use Composer to download all the required packages. Here is a link to help you with Drush download instructions.

The Migrate Upgrade Module

To use Drush for upgrades, you will also need the Migrate Upgrade Drupal module. It provides support for Drush when upgrading from Drupal 6 or 7 to Drupal 8. The Migrate Upgrade module prepares the necessary migrations, configures and executes them.

The Migrate Tools module is also necessary because it adds important commands like the following:

  • migrate-status — provides a list of migrations and their status.
  • migrate-import — imports the migrations.
  • migrate-rollback — performs rollback operations.
  • migrate-stop — stops the migration process.
  • migrate-reset-status — sets a migration status to Idle if it's got stuck.
  • migrate-messages — provides a list of messages associated with the import.

Before starting the upgrade process, we highly recommend that you backup the source website. It is also better to not use the live version of your destination website (for example, you could make a copy of it).

Every module you want to upgrade has to be enabled both on the source site and on the destination site.

Please note that the Drush Migrate Upgrade method is perfect for websites with no complex functionality. It will successfully migrate your content, taxonomy, and entities like comments, but not much more. To make migration of contributed modules possible, their developers should set migration classes, and most of them have not done that. If you wish to upgrade a more complex website, you could contact a Drupal agency like ours, and skilled developers will provide you with a smooth upgrade process.

The Migrate Upgrade module is “brought into to action” with the drush migrate-upgrade command.

So here goes this “magic” command:

 drush migrate-upgrade --legacy-db-url=mysql://user:pass@localhost/d6db --legacy-root=http://my-old-site.name

The configure-only option

Here’s an option for the migrate-upgrade command called --configure-only that will give you more flexibility in running your migrations.

 drush migrate-upgrade --legacy-db-url=mysql://user:password@server/db --legacy-root=http://my-old-site.name --configure-only

How does it work? Normally, the upgrade process includes two main phases:

  • the configuration, in which the database is analyzed, and the appropriate migrations are configured and saved.
  • the import, in which the above mentioned migrations are executed.

However, if you choose to use the --configure-only option, then only the first phase will be performed, so you will be free to select which migrations to run and which to not run. By running the drush migrate-status (ms), you will see all your migrations, and by running the drush migrate-import {migration name}, you can execute individual migrations. If you decide at that point that all migrations should be run, you can use the drush migrate-import --all command.

Have a smooth and flawless upgrade process with Drush, and enjoy the advantages of the new Drupal version! A brief overview of these advantages is available in our blog posts Improvements in Drupal 8: part 1 і part 2. If you are interested in articles with more technical details and examples from experience, check out our developers’ blog posts: Creating popups in Drupal 8, Theming in Drupal 8, Using Twig in Drupal 8, Configuration in Drupal 8, Drupal 8 development tips.

8 votes, Rating: 4

Read also

1

When you think of a body shop, probably the first thing that pops into your head is a shop for body products with bubbles of soap and...

2

Your new website deserves to be perfect from the start. However, in the pre-launch rush it is very easy to overlook important details....

3

Read on to find out more about what outstaffing is, how it differs from outsourcing, what its main benefits are, and how this phenomenon was developed in Ukraine — one of the most popular...

4

We love discussing the new features of the amazing Drupal 8 — so we are back at it again. In ...

Subscribe to our blog updates