Use Drush to Upgrade from Drupal 6 to Drupal 7

The Drush site-upgrade command supports upgrades from Drupal 6.x to Drupal 7.x. If you are just doing a minor version upgrade (e.g. 6.20 to 6.21), please use drush pm-update instead.

To begin, make sure that your current Drupal installation is running the most recent version of Drupal 6.x (currently 6.22). The most recent version is listed on the Drupal project page

Upgrade a Copy of your Site

site-upgrade always upgrades from the current Drupal site to an empty Drupal site. Drush never alters your source site, so it is safe to run this command from within your production site. It is necessary to create a site alias to describe the destination site. Site aliases are described in drush topic docs-aliases. A canonical site alias is adequate to define your target site for upgrade:

$aliases['onward'] = {
  'root' => '/path/to/upgraded/drupalroot',
  'uri' => '',

Optionally, you might also want to define a db_url to specify the name of your target database. If you do not, drush will compose a database name for you based on the name of your site alias.

Running the Site-upgrade Command

Drush will upgrade the current bootstrapped site (D6), and will put the result in the target site specified by the argument to the command. For example:

drush site-upgrade @onward

The site-upgrade command will perform the following operations:

  • Download latest stable release of Drupal 7 and store the files in the target site.
  • Write a new settings.php file with an appropriate databases structure for the new target site.
  • Make a copy of the SQL database for the new site.
  • The default theme for the new site will be set to Garland", and the admin theme will be set to Seven.
  • All non-core extensions will be disabled in the target database, and updatedb will be run on Drupal core.
  • All of the modules disabled in the previous step will be downloaded again, if they have a release for Drupal 7 (a dev snapshot is OK).
  • drush updatedb will be run again to update the non-core modules.
  • All of the non-core modules will be enabled again.

Before Drush begins this process, it will first print out a list of warnings for any modules that may not be ready to upgrade yet. Please read all of these messages carefully before proceeding. Here are some of the situations you may encounter.

  • If a module has no recommended release, then drush will continue, downloading an available release for the upgrade.
  • If a module has no release at all, then Drush will skip it. The module's data will remain in the database.
  • You may discover that some modules, such as date_api, might cause the Drupal core updatedb to fail. In this instance, you may use the --uninstall option to list the modules to uninstall prior to upgrade. Modules uninstalled in this manner will have all of their data removed from the target database; the database of the source site is not affected.

When Drush is enabling the modules in the upgraded site, if there are any new dependencies, they will also be identified and downloaded if possible. For example, views-7.x depends on the ctools module from the Chaos tool suite, whereas views-6 did not; drush will therefore download and enable ctools when upgrading the Views module from Drupal 6 to Drupal 7.

There will still be some work left to do after the site-upgrade command has completed; for example, you will still need to port your theme and any custom modules to the new version of Drupal, and some contrib modules may require additional work to update their configuration settings. Using site-upgrade will save you a considerable amount of time. There is no risk in trying it; if it does not work, you can always start over, or run it at a later date when more contrib modules have been updated. If you do run site-upgrade a second time on the same site, drush will ask you if you want to replace the existing target site, effectively starting over from the beginning, or re-use the code that is already present. In the latter case, drush will use the existing code, but will re-copy the source database and run updatedb on it again. This allows you to attempt to fix any non-working contrib modules yourself to get your site-upgrade working.