User login

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

Searched words: 
upgrade Drupal 6 upgrading from Drupal 6 to Drupal 7 updating to a major version

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.