Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
image.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Nov 2011 at 14:12 UTC
Updated:
14 Aug 2014 at 11:53 UTC
Jump to comment: Most recent
Comments
Comment #1
stevenwscott commentedDitto. It appears the field now exists, so how can I mark the update completed?
Comment #2
Rodney Strong commentedMine's a little different, but still the same type of issue:
Failed: DatabaseSchemaObjectExistsException: Cannot add field field_data_field_image.field_image_width: field already exists. in DatabaseSchema_mysql
Tried this on a brand new D7 site and a site that's 2 years old. Tried updating the db through the web interface and through drush, both resulted in the same error.
Comment #3
vishalkhialani commentedI have this same error. Did you guys manage to fix this ?
cheers,
Vishal
Comment #4
gagarine commentedI arrive if you add an image before playing the update (it's why you should put your server in maintenance mode). To solve it I manually delete the new field in the table and replay the update.
I change in normal as if you follow good practice nothing break
Comment #5
vishalkhialani commented@gagarine : how do we del it ?
Pls advice so that we can get rid of this issue.
You are right I had forgotten to put it in maintenance mode.
Cheers,
Vishal
Comment #6
vishalkhialani commentedComment #7
vishalkhialani commentedComment #8
vishalkhialani commentedsorry , double entry
Comment #9
Levdbas commentedok folks,
The way to solve this issue is the following.
1. log in into your database backend like phpmyadmin
2. select your database
3. select all the field tables which holds images.
4. delete the columns field_yourname_width & field_yournome_height
5. do this with every table with images and also the revisions
6. run update again in maintainence mode. If it's not working you're overlooking one of the fields.
This solved my issue, and next time, always put your site in maintainence mode.
Comment #10
stevenwscott commentedThanks Levdbas, worked perfectly.
Comment #11
greysun commentedI did not put my site into maintenance mode, but the "fix" does not work for me at all!
Comment #12
vishalkhialani commentedyes !! all done. will always rem the maintenance thingggy from now on
Comment #13
joachim commentedMoving to core.
Comment #14
davidbarratt commentedok, this is the error I was receiving:
What I discovered, was that Drupal thought that I was using an failed called "image" when the tables for that field do not exist. I am not sure why they didn't exist, but I obviously wasn't using the field since the tables themselves were not there.
and this is how I fixed it NOTE: only do this if you are receiving an error like above ("table doesn't exist")
this fixed my problem, and I hope it fixes yours.
thanks!
david barratt
Comment #15
JulienThomas commentedHello.
I can confirm this fix. The trick was to not forget the revision tables ...
For example, consider you have already set an image in a field like field_image_image.
You must perform the following sql queries. Note that the maintenance mode is not mandatory yet strongly advised :)
The error occured as the fields *_height and *_width already existed.
Cheers.
Comment #16
kyriakos1977 commentedThanks Levdbas, worked perfectly.
Comment #17
robertcfi commentedFollowed #9 and worked perfectly. Sucked trying to find all the fields but it does work once you suck it up and delete all of them.
Comment #18
MickC commentedFix worked - not only that but it recreatd the data.
I had data in these fields and was concerned it would get lost so I renamed the fields instead of deleting.
After running update it created the new fields with exactly the same wight and height data as my renamed fields.
I'm assuming therefore it is reading this metadata from the image files themselves, and it may well be safe to delete the fields even if you have data in them.
Comment #19
siteogra commentedhttp://drupal.org/node/1348410
in /modules/image/image.install 270 line
$spec['description'] = 'The width of the image in pixels.';
// db_add_field($table, $field_name . '_width', $spec);
if (!db_field_exists($table, $field_name . '_width')){
db_add_field($table, $field_name . '_width', $spec);
}
$spec['description'] = 'The height of the image in pixels.';
// db_add_field($table, $field_name . '_height', $spec);
if (!db_field_exists($table, $field_name . '_height')){
db_add_field($table, $field_name . '_height', $spec);
}
Comment #20
etibmw commentedHi
Iused #9 thanks Levdbas
solved my issue
Comment #21
Magdiel Veliz commentedThanks Levdbas
really Works for me....
Comment #22
patoshi commentedhaving same issue as of feb 23. using latest dev... is there a way to solve this issue without having to delete the columns manually?
Comment #23
patoshi commentedHere's a solution without having to go into your database:
open up modules/image/image.install
Delete the following:
Line 271 db_add_field($table, $field_name . '_width', $spec);
Line 274 db_add_field($table, $field_name . '_height', $spec);
This will bypass the column creation error.
drush updb .... and win!
Comment #24
samhaini commentedthanks , it worked very well for me...
Comment #25
drupov commentedFor me it worked too. Thanks!
What I did was to comment those two lines rather than delete them and update the db.
After the update I uncommented them and still got no errors.
Comment #26
patoshi commentedhaving same issues with 7.14 upgrade.. apply my same fix. but there really should be a conditional to check if the column exists or not...
Comment #27
patoshi commentedAdded to the image.install to check if columns exists or not:
This should resolve most issues as doing the other way might cause problems since we're just completely taking out the column creation completely. =)
Comment #28
simon fraser commentedthank you for that! and indeed for all the valuable help with this
(simply commenting those two lines out works for me)
still puzzled why this issue with one site (in core drupal-7.14) should affect one site and yet not others, but seeing no 'Failed' error message at last is perfectly good enough for me!
Comment #29
nedim.hadzimahmutovic commented#19 thanks, worked for me.
Comment #30
webchickWould someone be able to formulate the solutions that are working here into a patch, so we could fix it for everyone?
Comment #31
fraxinus commentedThanks very much, Levdbas. Your method (#9) has now worked for me. I have cleaned out the field tables as you suggested, updated to Drupal 7.16 and all is now sweet again.
Comment #32
Jeroen94 commentedI get the following error over and over again when I try to update the database.
How can I fix this? Please help!
Comment #33
Aptalops commentedThanks all #23 solved it for me.
Comment #34
vj commented#19 works fine. Tested by upgrading drupal 7.14 to 7.31