Categories

(83)
(69)
(8)
(34)
(74)
(149)

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 web 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.

9 votes, Rating: 4

Read also

1

Discover Drupal module development services and find out what your website can do for you.

2

Drupal 7… how will it affect your site upgrade? Oh, be sure it will — there are some major differences between Drupal 6 and Drupal 7. First and foremost, Drupal 6 will no longer be supported or...

3

Creation of RTL CSS is quite an important process in front-end, necessary to make the design comply with the RTL standards. This process involves the substitution of margin-left by margin-...

4

Useful tips by the developers of our Drupal development company make social networks closer and your life easier ;) Lots of people almost live in social networks and follow websites’ news directly...

5

According to “web weather” forecasts, lots of site owners will wish to upgrade their website from Drupal 6 to 8 or 7 in the nearest future :) Why? While the whole world celebrated the release of...

Subscribe to our blog updates