Drupal 5 to Drupal 7 Migration

drupal-migration

I currently manage two Drupal 5 sites.

So much time has passed since Drupal 7 was released, many personal migration scripts found on blogs and forums are no longer available.

I actually did a migration two years ago. Projects got in the way and the SQL files I wrote were lost.

The recommended way

The easiest step was to upgrade to Drupal 6 and then to 7. Unfortunately it didn’t work.

Migration module & d2d

I spent two weeks extending the migration module. However i found out too late that:

  • Node revisions aren’t migrated
  • The menu migration class doesn’t exist for Drupal 5

Writing my own module for Drupal 7

After grappling with the migration module to do things it wasn’t meant for, I decided to write my own module.

module  admin default tab

  • It really was only worth doing because I needed to do more than one migration.
  • Writing a UI that allows you to choose migration by content is important to me. I needed to make sure only relevant content is migrated. We have several content types that are deprecated.
  • I wanted something nicer than the shell script I wrote years ago.

There are limitations that I can live with:

  • My target environment runs PHP 5.2. This means that PHPUnit is nearly impossible to run. No unit tests for me!
  • Reverse engineering the Drupal 7 schema can be difficult. Several migration objects are not “pure”: I was unable to figure out how to get the UID of a file revision. Also, file listings in Drupal 7 are numerically indexed. Doesn’t exist in Drupal 5.

Caveats

  • Certain data will not be migrated. This includes custom fields and taxonomy data. We don’t use these features on our installs so I didn’t bother. 
  • Use this module in a dev environment. Things have a high chance of going pear shaped. 
  • If you’re a developer, I hope theres some code that helps contribute to your own custom migration script. 

Download the Drupal 5 to Drupal 7 Migration module on Github.