I've just upgraded to the latest dev version (as of Jan. 18th) and run the db updates. In #6100 of both image and image_attach modules, it partially fails. The error log shows:
image_attach module
Update #6100
ALTER TABLE {image_attach} CHANGE nid `nid` INT unsigned NOT NULL DEFAULT 0
ALTER TABLE {image_attach} CHANGE iid `iid` INT unsigned NOT NULL DEFAULT 0
Failed: ALTER TABLE {image_attach} ADD PRIMARY KEY (nid)
Failed: ALTER TABLE {image_attach} ADD INDEX iid (iid)
image module
Update #6100
ALTER TABLE {image} CHANGE nid `nid` INT unsigned NOT NULL DEFAULT 0
ALTER TABLE {image} CHANGE fid `fid` INT unsigned NOT NULL DEFAULT 0
Failed: ALTER TABLE {image} ADD PRIMARY KEY (nid, image_size)
ALTER TABLE {image} ADD INDEX fid (fid)
Update #6101
No queries| Comment | File | Size | Author |
|---|---|---|---|
| #5 | image-HEAD.indexes.patch | 1.38 KB | sun |
| #4 | image-HEAD.image-indexes.patch | 642 bytes | sun |
Comments
Comment #1
sunHm. This means that your tables somehow already had primary keys and indexes. I don't know how this happened to your tables, but the failing queries do not harm you.
If anyone else experiences those failing queries, please add precise information about the upgrade path you performed so far (i.e. 4.7 -> 5.x-1.x -> 5.x-2.x -> 6.x-1.x, or which parts of that, or no previous version at all?)
Comment #2
gábor hojtsyWell, it is pretty clear from http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/image/image... why it is broken.
image_update_5200() adds the table with PRIMARY KEY (`nid`, `image_size`), and INDEX image_fid(`fid`) and then image_update_6100() tries to add the two indexes again. So in case you run these two updates in succession it will report these errors. How is this fixed??
Comment #3
gábor hojtsyBTW image_attach has the same problem with its indexes with image_attach_update_1() and image_attach_update_6100().
What Drupal core does to my knowledge is to drop indexes before fiddling with fields, and then readd them, and it does not assume that all supported databases will drop indexes on a field, if you change them. Looks like our database does not drop indexes, although the image module code might assume that.
Comment #4
sunSo we just drop the (potentially) existing primary key and index before adding our new.
Comment #5
sunCombined for image and image_attach.
Comment #6
sunAfter stumbling over #363262: Missing index on url_alias table and #360854: db_index_exists() missing, module updates cannot handle indexes properly, this patch is the proper fix.
Committed.
Comment #8
rajaito commentedhow do I run the patch?
Comment #9
rajaito commentedComment #10
rajaito commentedCan I reactivate this topic?
Please instruct us how to install your patch. Thank you.
Comment #11
sunYou don't need to apply the patch. You need to download the latest development snapshot instead.