Monday, December 22, 2014

Migrating Drupal 6 to Drupal 8


Drupal started its journey in year 2001. In 2015, Drupal is going to launch its 8th version. With release of new version migration from older version to the new version is always a big challenge.

Drupal 6 is one of the most popular version of Drupal. This post provides steps to migrate Drupal 6 to Drupal 8 (D6 to D8)

System Environment
In Drupal 8, Drush is an integral part of its development process. Migration is possible only from command line and using Drush. Drush is a command line shell and Unix scripting interface for Drupal. Drush core ships with lots of useful commands for interacting with code like modules/themes/profiles. Similarly, it runs update.php, executes sql queries and DB migrations, and misc utilities like run cron or clear cache. Drush is a part of GitHub. GitHub is a free distributed revision control system to provide speed, data integrity, and support for distributed, non-linear workflows.

Installation
You can get latest version of GitHub software at: http://git-scm.com/download

Drupal recommends installing Drush 7.x via Composer. Composer is a Dependency Management for PHP.
You can find instructions to install Composer on Windows or Linux / Unix / OSX machine at: https://getcomposer.org/doc/00-intro.md

After successfully installing GitHub and Composer, installing Drush 7 is easy. Open GitHub and type:
composer global require drush/drush:dev-master

Drush is now installed on your system. You can find more details on Drush installation on Drupal website at https://www.drupal.org/node/2366283

Set Paths
Now it is required to set path for Drush.
In Windows you can set the path manually from My Computer > Properties > Advance Setting > System Variable > Path

In Linux or Unix you can use bash profile file to add path.
The required components are installed.

Open Git.
Change root path to your drupal folder. For me it is:
cd c:/wamp/www/beta4

Check Drush status. Type:
drush status

Set Git path, type:
git init

Migrate
It is required that Migrate module is enabled in Drupal 8 website.

In order to execute a migration, manifest file is required. You can download the manifest files from Drupal website (https://drupal.org/node/2221779) and save it in the root folder of the Drupal.
Drupal supports two types of migration – module-by-module and complete migration. We will perform complete migration. It is required that all the modules used in your Drupal 6 website are enabled in Drupal 8 website.

Execute migration using drush command:
drush migrate-manifest --legacy-db-url=mysql://<username>:<password>@<host>:<portno>/<db_name> <manifest-name>

Where:
<manifest-name> is the name of the manifest file created for the migration. The path is not necessary, but the extension is (if there is one).
--legacy-db-url is a Drupal 6 style database URL.
<username> is the Drupal 6 database user name.
<password> is the Drupal 6 user's password to the database.
<host> is either localhost or the IP address of the database server. The normal "local" server's IP address is 127.0.0.1
<port> If you database is not using the standard port, you will need to specify your port number here. This is an optional setting.

I am working on my local setup and therefore the command is:
drush migrate-manifest --legacy-db-url=mysql://root:@localhost/drupal6 D6Manifest-Complete.yml

This completes the migration.
Drupal is still in its beta phase and is changing regularly, I had tested the above migration process with beta2 and beta4 releases of Drupal 8.

No comments:

Post a Comment