The upgrade to version 5.x.2 did not go smoothly. There were errors regarding duplicate keys and the upgrade failed. I ended up running a manual SQL query to insert the correct content:

insert into image (nid, fid, image_size) select files.nid, files.fid, files.filename from files on duplicate key update nid=files.nid;

I had only images the files table, so this was not a problem for me. Adding a where clause which listed the current file sizes would make the query more generic. I've seen reference to a rebuild option in the D6 version of the module, but I haven't found it in the GUI for D5. I thought this snippet might be useful for someone who's "lost" their images.

see also: #583076: Error on Database Updates for 6100 when upgrading to Beta3: 'duplicate entry' for primary key

Comments

joachim’s picture

Status: Active » Closed (duplicate)

Amazing what sleep does!
Found the issue this is a duplicate of: #207557: update 5-1 to 5-2 gives user warning: Duplicate entry '611-thumbnail' for key 1 query in image_update_5200. Reopening it.