Upgrade Drupal 6 to Drupal 7 using Drush site-upgrade

Ok... So you decided that it's time to upgrade from Drupal 6 to Drupal 7. It's not going to be easy, but using Drush will make life a little easier.

What this will do is save you the time of manually upgrading Drupal 6 core and drupal 6 modules to Drupal 7 core and drupal 7 modules. Of course likely your site will be broken after the drush site-upgrade, but at least you have the manual job of searching for upgraded modules taken care of.

So, let's begin...

Install latest version of Drush


cd /usr/local/share
# install GIT if not available
yum install git
git clone https://github.com/drush-ops/drush.git drush
ln -s /usr/local/share/drush/drush /usr/local/bin/drush
drush

If all went well, last command 'drush' should bring up all the drush commands.

setup Drush aliases

Now we need to tell Drush where the new site will be located... Drush doesn't overwrite the original site, so we need to tell it where the DEV/TEMP location will be.


vi /usr/local/share/drush/aliases.drushrc.php

Paste this code into it (hit "i" on your keyboard to insert)


$aliases['newdrupalsite'] = array(
'uri' => 'localhost',
'root' => '/absolute/path/to/your/new/drupal/site', // This must be a full full path, not a relative one
'db-url' => 'mysql://DBUSER:DBPASS@localhost/DBNAME', //this is your new DB that you will have to create before the upgrade
);

Ok... so now we have that done, we start the process:


cd /location/of/drupal6/site
drush site-upgrade @newdrupalsite

Now just follow the direction... and you should be on your way... it will take Drush a while to do the upgrade, and will ask you a few questions.

NOTE: one of the later steps will show a long list of modules. Basically you want to select the option "Automatically enable and upgrade all modules remaining in list".

Also when asked "Enable the core module content_migrate." select "Do not enable the content migrate module".

Remember, Drush never overwrites the source site or database, so you don't have to worry about messing up your original site.

Troubleshooting

If you get the following error message:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'label' in 'field list': SELECT aid, callback, label[error]

  • Open up phpMyAdmin, and select the Drupal 6 database that you're upgrading FROM.
  • Select the "SQL" tab
  • Paste the following SQL query:


-- phpMyAdmin SQL Dump
-- version 3.5.3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 21, 2012 at 11:07 PM
-- Server version: 5.5.28-log
-- PHP Version: 5.4.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

-- --------------------------------------------------------

--
-- Table structure for table `actions`
--

DROP TABLE IF EXISTS `actions`;
CREATE TABLE IF NOT EXISTS `actions` (
`aid` varchar(255) NOT NULL DEFAULT '0' COMMENT 'Primary Key: Unique actions ID.',
`type` varchar(32) NOT NULL DEFAULT '' COMMENT 'The object that that action acts on (node, user, comment, system or custom types.)',
`callback` varchar(255) NOT NULL DEFAULT '' COMMENT 'The callback function that executes when the action runs.',
`parameters` longblob NOT NULL COMMENT 'Parameters to be passed to the callback function.',
`label` varchar(255) NOT NULL DEFAULT '0' COMMENT 'Label of the action.',
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Stores action information.';

--
-- Dumping data for table `actions`
--

INSERT INTO `actions` (`aid`, `type`, `callback`, `parameters`, `label`) VALUES
('comment_publish_action', 'comment', 'comment_publish_action', '', 'Publish comment'),
('comment_save_action', 'comment', 'comment_save_action', '', 'Save comment'),
('comment_unpublish_action', 'comment', 'comment_unpublish_action', '', 'Unpublish comment'),
('node_make_sticky_action', 'node', 'node_make_sticky_action', '', 'Make content sticky'),
('node_make_unsticky_action', 'node', 'node_make_unsticky_action', '', 'Make content unsticky'),
('node_promote_action', 'node', 'node_promote_action', '', 'Promote content to front page'),
('node_publish_action', 'node', 'node_publish_action', '', 'Publish content'),
('node_save_action', 'node', 'node_save_action', '', 'Save content'),
('node_unpromote_action', 'node', 'node_unpromote_action', '', 'Remove content from front page'),
('node_unpublish_action', 'node', 'node_unpublish_action', '', 'Unpublish content'),
('og_membership_delete_action', 'og_membership', 'og_membership_delete_action', '', 'Remove from group'),
('pathauto_node_update_action', 'node', 'pathauto_node_update_action', '', 'Update node alias'),
('pathauto_taxonomy_term_update_action', 'taxonomy_term', 'pathauto_taxonomy_term_update_action', '', 'Update taxonomy term alias'),
('pathauto_user_update_action', 'user', 'pathauto_user_update_action', '', 'Update user alias'),
('simplenews_action_cron_run', 'simplenews', 'simplenews_action_cron_run', '', 'Send pending simplenews newsletters'),
('system_block_ip_action', 'user', 'system_block_ip_action', '', 'Ban IP address of current user'),
('user_block_user_action', 'user', 'user_block_user_action', '', 'Block current user'),
('views_bulk_operations_archive_action', 'file', 'views_bulk_operations_archive_action', '', 'Create an archive of selected files'),
('views_bulk_operations_argument_selector_action', 'entity', 'views_bulk_operations_argument_selector_action', '', 'Pass ids as arguments to a page'),
('views_bulk_operations_delete_item', 'entity', 'views_bulk_operations_delete_item', '', 'Delete item'),
('views_bulk_operations_modify_action', 'entity', 'views_bulk_operations_modify_action', '', 'Modify entity values');

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Now try redoing the site-upgrade from scratch by selecting "[3] : Delete the existing target: start over from the beginning. "

*****

Sometimes the upgrade process freezes at Step 12-a. If that happens, try restarting mysql


service mysqld restart

Then start from scratch. "[3] : Delete the existing target: start over from the beginning. "

Tags: Drupal drush