Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
During the upgrade process to Drupal 6, I noticed that my imagecache presets were broken. I deleted them and tried to create a new one. This resulted in this error:
Field 'presetid' doesn't have a default value query: INSERT INTO imagecache_preset (presetname) VALUES ('logo_klein') in E:\Apache\htdocs\totem_6\includes\common.inc op regel 3324.
I was able to solve this by setting the auto_increment property on the presetid column in the imagecache_preset table, but I'm not sure if this is the real solution or an ugly hack.
Comment | File | Size | Author |
---|---|---|---|
#6 | imagecache_333769.patch | 1.33 KB | drewish |
Comments
Comment #1
marcvangend(Sorry for the error with the < code > tag!)
By the way, I forgot to mention I had to do the same with the actionid column in imagecache_action in order to add actions.
Comment #2
techninja CreditAttribution: techninja commentedYep, same problem here. Too bad I decided it was my old d5.x presets before noticing/checking the issue queue (And deleting them all). Good call marcvangend!
I can switch up the table, but unfortunately this leaves our less advanced brethren out of the loop (Not to mention, it might very well be a nasty hack, as I recall drupal was supposed to handle auto-increments through the database abstraction layer because of shoddy support for auto-increment in DB systems other than mysql)
Suggestions anyone?
Comment #3
yhahn CreditAttribution: yhahn commentedYou can re-implement the primary keys (which will receive the auto increment property) with the following snippet in imagecache.install using the Schema API.
Comment #4
dopry CreditAttribution: dopry commented@yhahn: can you post as a patch?
Comment #5
drewish CreditAttribution: drewish commentedRead the docs for hook_update_N, you can't reference the schema in an update. Think about it for a minute... what happens after you update the schema and someone goes to run this update... assumptions you're making about the schema will no longer be true.
Comment #6
drewish CreditAttribution: drewish commentedtotally untested but here's the correct way to do this.
Comment #7
drewish CreditAttribution: drewish commentedsee #304376: Update function from 5.x -> 6.x