Upgrading a Drupal 6 site to Drupal 7
These are notes for what will be an Appendix in the Definitive Guide to Drupal 7.
Before we do anything to try to upgrade a site, we back it up. We also never upgrade the live, production instance of a site, but a copy. (At least the first time.
[gotcha] If copying over the entire code of a site, make absolutely certain that we have changed the database connection settings in settings.php. Especially if we are (and we shouldn't be, but if we are) on the same server as our live site. [/gotcha]
First, we make a complete copy of our Drupal 6 site.
Copy all files and folders to a new directory.
Create a database. Export a copy of the live site's database, and import it into the new test database we just created.
We log in to this test site and disable all modules.
Disable modules, including
Command Line Steps
mysql -u site6 -pPASSWORD site6 < ~/workspace/site6.sql
vi ~/workspace/site6/sites/default/settings.php
mysqldump -u site6local -pPASSWORD site6local > ~/workspace/site6local.sql
mysql -u site7 -pPASSWORD site7 < ~/workspace/site6local.sql
vi ~/workspace/site7/sites/default/settings.php
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'd7b',
'username' => 'd7b',
'password' => 'd7b',
'host' => 'localhost',
);
AND
about line 200, change the $update_free_access variable from FALSE to TRUE.
$update_free_access = TRUE;
[gotcha] If the update.php does not work the first time, we need to wipe all tables from the database before re-importing and trying again. Otherwise, we will hit errors due to tables and indices Drupal 7 adds already existing. [/gotcha]
Explanation of the Gotcha:
After failing to update the first time due to comment module, among others, being enabled, trying again is not an option.
For instance: Error message
DatabaseSchemaObjectExistsException: Table cache_path already exists. in DatabaseSchema->createTable() (line 614 of /home/ben/workspace/d7b/includes/database/schema.inc).
The website encountered an unexpected error. Please try again later.Error message
DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex() (line 424 of /home/ben/workspace/d7b/includes/database/mysql/schema.inc).
The website encountered an unexpected error. Please try again later.Error message
DatabaseSchemaObjectExistsException: Table role_permission already exists. in DatabaseSchema->createTable() (line 614 of /home/ben/workspace/d7b/includes/database/schema.inc).
The website encountered an unexpected error. Please try again later.
Reference
Upgrading - more sophisticated approach
http://drupal.org/node/323089
Upgrading from 6 to 7 tips
http://drupal.org/node/724102
Upgrading sites from Drupal 6 to Drupal 7 (discussion mostly on custom modules)
http://acquia.com/blog/upgrading-sites-drupal-6-drupal-7-time-test-it-out
Comments
Post new comment