Migrating a large active and customised Drupal 6 site to Drupal 7

We had an existing customised Drupal 6 site that needed some general updates, and we thought, while we were here working on themes and features, let's to do a major upgrade the Drupal framework too! This was a a bigger job than we had anticipated - but on reflection still the right thing to do.

You can't just click the "Upgrade to Drupal 7" button

Automatic scripted updates are a nice idea - particularly as they are relatively effortless and repeatable. There are some good tools with Drush that will help with your migration from Drupal 6 to Drupal 7. They are not straightforward, and will not leave you with a complete migration - there will still be manual work to do - but they help get you started.

The biggest problem we found with automated update scripts is that they also migrate our junk - the old ways of doing things from before we knew better, or were hacks to get around the limitations of Drupal 6. A large proportion of the value of a site redesign to us is the renewal aspect: a chance to improve the code and make things work better. If upgrading a major version of Drupal is like moving house - automatic updates is leaving the movers to do your packing without sorting out what you want to take first.

The site was going through some major changes to the theme, architecture and functionality so we could justify a larger site rebuild. This has given us the opportunity to clean up things, and apply some better practices we had learned over the years.

Migrating content

With a fresh base install on a new version of Drupal, the challenge turns to migrating content. There is a contributed a module called Migrate, which has support for scripting Drupal-to-Drupal migrations of content, but I could not get me head around it, so I wrote my own set of database migration scripts using node.js. It took some learning of the inner mechanics of Drupal's database but eventually I came up with a set of scripts that could be re-run at any point during the new site development to bring the latest live content to the dev version.

Here are the steps we took to migrate the site:

1. consolidation/prep phase

Do the upgrade:

Run some post migration tasks

Post migration content migration scripts

At this point we have a working version of the site structure and content on a new site based on Drupal 7. It's not perfect or complete, but it runs, and is a good base to continue development of new themes and modules. To give us the freedom to develop and get this right, we wrote some scripts that enable us to empty the new site of all content, and re-import everything from the old site. In theory, being scripted, this can be run regularly during development to keep the content of the two versions of the site in sync while development continues.

Is it worth it?

Yes. Drupal 6 was showing its age, and the benefits of Drupal 7 and our improved knowledge of it make it an easier platform for us to write good code. I am happy with how the fresh clean slate we have in a new version without so much cruft. We are now monitoring and improving performance of the site.