Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi to all!
I have an update problem from Image alpha4 to last alpha6 version.
This is the log file at the end of update process:
user warning: Can't DROP 'PRIMARY'; check that column/key exists query: ALTER TABLE drupal_image_attach DROP PRIMARY KEY in /var/www/drupal/includes/database.mysql-common.inc on line 386.
user warning: Can't DROP 'iid'; check that column/key exists query: ALTER TABLE drupal_image_attach DROP INDEX iid in /var/www/drupal/includes/database.mysql-common.inc on line 448.
user warning: Unknown column 'blocks.module' in 'where clause' query: DELETE FROM drupal_blocks WHERE blocks.module = 'image_attach' AND blocks.delta = 0 in /var/www/drupal/modules/image/contrib/image_attach/image_attach.install on line 123.
user warning: Can't DROP 'PRIMARY'; check that column/key exists query: ALTER TABLE drupal_image DROP PRIMARY KEY in /var/www/drupal/includes/database.mysql-common.inc on line 386.
user warning: Can't DROP 'image_fid'; check that column/key exists query: ALTER TABLE drupal_image DROP INDEX image_fid in /var/www/drupal/includes/database.mysql-common.inc on line 448.
The following queries were executed
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} DROP PRIMARY KEY
ALTER TABLE {image_attach} ADD PRIMARY KEY (nid)
Failed: ALTER TABLE {image_attach} DROP INDEX iid
ALTER TABLE {image_attach} ADD INDEX iid (iid)
Update #6101
Failed: DELETE FROM {blocks} WHERE blocks.module = 'image_attach' AND blocks.delta = 0
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#7 | image_6.x-1.0-alpha6_562810.patch | 1.89 KB | datune |
Comments
Comment #1
Dret CreditAttribution: Dret commentedSorry, This post (and the next one) are due to a Submission error, Please erase them.
Thanks!
Comment #2
Dret CreditAttribution: Dret commentedPlease erase this post.
Thanks!
Comment #3
Borromini CreditAttribution: Borromini commentedI can confirm this issue, just did an update from alpha4 to alpha6 on a freshly updated 6.13:
Can't DROP 'PRIMARY'; check that column/key exists query: ALTER TABLE image_attach DROP PRIMARY KEY in /var/www/drupal/includes/database.mysql-common.inc on line 386.
and
Can't DROP 'iid'; check that column/key exists query: ALTER TABLE image_attach DROP INDEX iid in /var/www/drupal/includes/database.mysql-common.inc on line 448.
Comment #4
joachim CreditAttribution: joachim commentedIs there anyone who knows about primary keys and the like who can shed some light on this?
Comment #5
rsvelko CreditAttribution: rsvelko commentedComment #6
joachim CreditAttribution: joachim commentedOK, so we're figuring this out at the D7 sprint... ;)
The problem is that 6-alpha-1 to alpha-4 don't define primary keys or indexes in hook_schema and yet image_attach_update_1() adds them.
In other words, the schema doesn't agree with the update functions.
So if you started back at version 5 or earlier, you get these added for you when you update.
If you start with one of these alphas, you don't.
Alpha 1-3: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/image/contr...
Alpha 4: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/image/contr...
Alpha 5: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/image/contr...
Alpha 6: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/image/contr...
So since no subsequent update functions check if the key actually is there before trying to delete it, you get errors.
Comment #7
datune CreditAttribution: datune commentedThis should resolve the issue, see comments for more info.
Comment #8
joachim CreditAttribution: joachim commentedGah, lost wifi ate my comment!
I've seen datune test this myself at the DrupalCon Paris ice cream sprint, so I'm happy that the patch is ready :D
Committed, with huge thanks to datune for figuring this hairy SQL problem.
Comment #9
rsvelko CreditAttribution: rsvelko commentedSuper!
For those that are not in Paris ( :jealous ) tell us - do you eat ice cream fast in these ice cream sprints?