A Quick Migration of Drupal 6 to Drupal 8

image

Over the last half year I’ve been involved in different migration projects for different customers.  These migrations commonly involved moving WordPress to Drupal-6, WP-to-D7, D6-to-D7, and D7-to-D8.

Migrations are way to move content from its original (source) site to its updated (target) site.  It's done in a structured way to save a LOT of work when compared to rebuilding a site from scratch. 

The funnest migration so far I’ve been involved with migrated a very large proprietary CMS portal site into a customized Drupal 7 distribution (OpenAtrium).  The original site was built on a postgres database and the new target site was specified to use MySQL.  The source site stayed "live" up to the day we "switched over" to the new site.  Needless to say, we did a lot of planning in advance to make sure we completed it within very tight time constraints.

Drupal 8 now has migration tools built into it right out of the box.  I wanted to see how well these worked so I decided to document the “quickest” way to migrate a Drupal-6 site to Drupal-8

Getting setup

On my MacBook Pro I already have setup multiple installs of acquia_dev_desktop .  All migrations involve moving content from your Source site to your Target site.  In this scenario I want to migrate the most recent versions of Drupal-6.38 to Drupal-8.0.5.  To get those I like to click on the terminal access button from the dev_desktop app (the little black box in the upper right corner). 

This opens up my terminal to a directory close to where I want to be.  From that location (in my Mac Terminal) I just type in  

    cd  ..    

which takes me back one level to the root of my acquia_dev_desktop directory.

From there, using drush, I type in 

    drush  dl  drupal-6    

to get my Source files and

    drush  dl  drupal-8    

to get my Target files.

I then select the + icon in the lower left of dev_desktop to “Import local Drupal Site…”

and walk thru the setup, creating ‘…a new database’ for each.

Since they are new sites, I access them again thru the top “Local site:” link on dev_desktop and walk thru the Drupal setup wizards for each.

Inventory

So at this point I have standard profiles for D6 core and D8 core installed.  The core modules enabled are those that are enabled out of the box via the Standard setup profile.

Prepare the D6 Source Site

Since the D6 site is a fresh install there is no content at the moment.  Of course I need content if I am running a migration so I'll create some quickly for this demo.

Back at my terminal again for the D6 site I use the following drush command …

    drush  en –y  admin_menu  devel  cck  link    

this downloads, installs and enables the following modules.

Admin Menu - 6.x-3.x-dev

Devel -  6.x-1.28

CCK - 6.x-2.10

Link - 6.x-2.7

The “drush en –y” part of the command above also gets me additional module dependencies (such as ctools) downloaded, installed and enabled by default (not showing these for brevity).

I’m using these contributed modules to be able to quickly navigate and setup the D6 site with a lot of content.  Admin_menu gives me the black menu bar, and provides the handy “generate content” link.  So from that I quickly setup a bunch of Categories, Content, and Users as practice demo content.

So, now we have our source site setup on our local with lots of content.  If you are running a migration from an established live site, it is still easiest to get that site’s backup, install it locally, and update core and contributed modules to the most current stable release.

Prepare the D8 Target Site

On our target Drupal-8 site, I have a fresh install and I want to run through the module list there to make sure I’ve enabled the same content types I did on my source.  I also enable the D8 core Migrate, Migrate Drupal and the Drupal Upgrade UI modules.  Now we have our Source and Target sites setup to actually run the migration.

Running the Migration

Keeping with drush I then just need to run one more drush command and I’m “done”.

The following basic example gives the general form of the drush command,

    drush migrate-upgrade --legacy-db-url=mysql://user:password@server/db --legacy-root=http://mydrupal6or7site.com    

For my setup, it looks like this 

    drush migrate-upgrade --legacy-db-url=mysql://root:@127.0.0.1:33067/drupal_6_38 --legacy-root=http://drupal-6-38.dd:8083    

To get this right I normally paste it into a text editor, dissect the various parts and hunt down the correct parameters.  Drupal-8 does have a nice UI for this as well that is shown below. 

 

Either way, the information you input is from the Drupal-6 site, and the form you put it in is in the Drupal-8 site.

So, when you run that one drush command, it just runs and completes.  You are done.

Review

You can check the content to see what came in, and compare it to your D6 site.  You can go to http://drupal-8-0-5.dd:8083/upgrade and find the following …

 

At this point you can play around with it to get comfortable that you are getting what you wanted and expect.  I tried, for example, going back to the D6 site and creating another set of content.  Then I came back to the above screen and did a Rerun.  This migrated the additional content in so I had twice that of the first run.  Its what I expected.  I tried a Rollback.  That deleted all the content on the D8 site, resetting it back to my start point just before the migration.

Final Cleanup

All you need to do now is uninstall the D8 core Migrate, Migrate Drupal and the Drupal Upgrade UI modules that you enabled at the beginning.

Summary

This blog covered the quickest way to migrate a D6 site to D8.  We quickly setup new D6 and D8 sites using drush and acquia_dev_desktop.  With one drush command we added several additional modules to our D6 site that let us quickly create a LOT of content to migrate.  Prepping the D8 site meant enabling the three migrate modules in core.  The migration itself was just one Drush command.  With this workflow I can easily do it in less than 15 minutes.

The key to any migration is a clear plan detailing the content you need to get and where it needs to go.  The more complex the data sets you are dealing with, the more detailed the plans need to be.  

There are "Known issues when upgrading from Drupal 6 or 7 to Drupal 8" that may require special attention when performing your particular migration.  However, with the steps outlined above, you can show a lot of progress in a very short period of time.  These quick migrations are helpful in visualizing the issues and requirements of migrating more complex data sets.

 

 

 

Subscribe to Our Newsletter

Stay In Touch