An upgrade note on going from Migrate 6.x-2.0-beta2 to 6.x-2.0-beta3

29 Dec 2010
Posted by jcfiala

I'm currently in the midst of setting up a migration from a pretty huge MS SQL database to Drupal, in D6. This migration not only involves Microsoft SQL Server, as I mentioned, but it also involves using mongodb, so we're basically touching three different databases here.

So, I've been using the 2.0 branch of Migrate for 6.x, because I was curious about seeing it again, and I know it worked quite well for Examiner. (Yes, they were doing Drupal 7, but it was still the same basic idea.) It's been going very well.

Today I updated to the 6.x-2.0-beta3 version of the code, and I had to make a couple small changes to my existing module. I'm reproducing them here, in hopes that it can prevent others from having trouble like I did.

  1. Put the following code in your module file:

    function migrate_example_migrate_api() {
      $api = array(
        'api' => 2,
      );
      return $api;
    }

    Yes, I copied that out of the migrate_example.module file from the migrate_example directory you get with the migrate module. You might as well do the same thing, only you'll naturally need to change the code name, as this is an implementation of hook_migrate_api().

  2. Find all of the references to the Migrate class names and remove Migration from them.

    In this case I'm talking about all the places where you pass the class name as a string to a function. Two places where you're likely to do this is with setting dependencies or softDependencies for a migration, or where you're specifying a source migration for a field mapping. Just search for all of your UserMigration or FooMigration and replace them with User or Foo.

  3. You may need to fix migrate_status table

    I found that when I went to admin/content/migrate, I would see errors that getInstance was throwing that it was being passed a boolean instead of an array. I tracked this down to the migrate_status table, which now has a class_name field and an arguments field. If your arguments field is empty, edit it to contain this string:

    a:0:{}

    (which is a serialized empty array). The error will then be gone.

Tags: