Upgrading to Drupal 6 seems like a big step, even though I can't say that I'm using many modules, nor that I have a very complicated setup. Today, during a test upgrade, I've noticed the following problem: the image module, version 6.x-1.0-alpha2 failed to upgrade with the following SQL error: Unknown column 'f.nid' in 'field list' query.
The culprit is the following SQL statement:
INSERT INTO image SELECT DISTINCT f.nid, f.fid, f.filename FROM files f INNER JOIN node n ON f.nid = n.nid WHERE n.type='image' AND f.filename IN ('_original', 'thumbnail', 'preview')
After following a very helpful tip, I've came up with the following sequence for upgrading the image module, after switching to Drupal 6:
- Make a backup of the 'files' table.
CREATE TABLE files_old SELECT * FROM files;
Please note that the backup must be made before upgrading to Drupal 6; to be more specific, before running theupdate.phpscript for the upgrade. If you've already done this, you'll probably need to restore the oldfilestable from a backup. - Run the drupal update script
http://yoursite/update.php - Run the failed SQL statement, using the old files table:
INSERT INTO image SELECT DISTINCT f.nid, f.fid, f.filename FROM files_old f INNER JOIN node n ON f.nid = n.nid WHERE n.type='image' AND f.filename IN ('_original', 'thumbnail', 'preview') - Remove the temporary table
files_old:
DROP TABLE files_old;