Notes towards a saner Drupal 6 to 7 upgrade method using drush

[Image attribution: eric]

For when drush sup just doesn't work consistently.

The rational here is that if we break upgrade into 3 stages we'll minimize the risk of unintelligble errors. That and a hardcore prep stage will make everything much easier down the line.

This overview expects you'll already have your custom modules re-written for D7. The coder_upgrade module is a great starting point (don't forget to install grammar_parser as a library in the libraries folder.

Overview

Prep (steps 1-3)

  1. Set up your local/dev version of the current site
  2. Cut out all the dead wood, don't upgrade stuff that doesn't need to be upgraded, especially if you're going to be going through the exact same process more than once. That can easily happen, for example if you're going through once to document the process or if you need to create a test version of a live site that will then need to updated with current content. Be firm, and if in doubt cut it out, you'll always be able to add it back in later.

Stage 1 update core (steps 4-6)

Copy the current code base to a new folder (maybe alias the files folder if you need to, or you can override the location in settings.php $conf['file_directory_path'] = OLD_PATH).

This should be relatively straightforward as by now most of the upgrade bugs have been resolved. Re-hashing the user passwords takes a long time - don't be put off by endless User [7000] updates as it batches the process - took 20 mins on my machine for 600K users.

Stage 2 update contrib including CCK (steps 7-12)

Here you list all the non-core modules and download them. The list ends up having all your custom modules in it too, but as they don't exist on drupal.org they won't be downloaded. In fact having all the modules downloaded will throw a few errors when drush dl tries to download sub modules which are part of a larger package (e.g. date modules).

Stage 3 update custom modules (step 13 - lucky for some!)

You're own your own right here. The coder upgrade module is a great starting point

Steps

  1. Download site to local machine
  2. Evaluate current site. What can go? Delete it, make a list as you go. Ask about, does anyone actually use that module/feature whatever? You can probably re-insert it if you need to later.
  3. Does the site still work? If not return to 2.
  4. Copy sites folder without modules
  5. Replace core code with D7 code
  6. Run drush updb
  7. In original site make a copy of currently enabled non-core modules:

    > drush pml --no-core --status=enabled --type=module --pipe >! modules_enabled_non_core.txt
    
  8. cd to new site, move enabled modules mv ../old_site/modules_enabled_non_core.txt .

  9. Use xargs to loop through and download contrib modules

    > cat modules_enabled_non_core.txt | xargs -L 1 drush -y dl
    
  10. Fix the settings.php file

  11. Run drush updb again until it's all done. Fix any errors, cheat if you have to and advance the schema_version in the system table if you think that'll help.
  12. Download and enable cck, content_migrate and new fields to replace the old CCK ones

    > drush dl cck
    > drush en content_migrate
    > drush en image
    > drush dl references
    > drush en references node_reference
    > drush content-migrate-status #check status & download needed field types.
    
  13. Re-install your custom modules and theme and then perform the updates, drush updb.