Hello, I can't create new actions in presets. When I save action, I've got an error:

user warning: Unknown column 'module' in 'field list' query: INSERT INTO imagecache_action (presetid, weight, module, action, data) VALUES (0, 0, 'imagecache', 'imagecache_scale_and_crop', 'a:2:{s:5:\"width\";s:3:\"100\";s:6:\"height\";s:2:\"70\";}') in D:\portal\nnn\www\includes\common.inc on line 3318.

My solution is to add new update iteration for missing field in imagecache.install

function imagecache_update_5() {
  $ret = array();
  db_add_field($ret, 'imagecache_action', 'module', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
  return $ret;


Status:Needs review» Needs work

if that's a D6 update function (i'm guessing it is because it's calling db_add_field()) then the update needs to be named 6000.

marked #321190: Drupal 6 upgrade path as a duplicate... it has the update number right but wasn't using db_add_field(). it also had a bit to set the module on existing actions:

+      $ret[] = update_sql("UPDATE {imagecache_action} set module = 'imagecache'");

not sure if it's necessary but since i'm marking it as duplicate i didn't want that bit get lost.

also this need to be submitted as a proper patch see http://drupal.org/patch for more details

Title:SQL-error when creating new actionUpdate function from 5.x -> 6.x
Version:6.x-1.0-alpha2» 6.x-2.0-beta3
Status:Needs work» Needs review
new1009 bytes

Here's a patch that implements imagecache_update_6000(). It modifies the tables to make the primary keys serial types. It follows the way it is done for core in system_update_6019.

new1.15 KB

new patch also removes imagecache entries in the sequences table

new1.17 KB

sorry for so many posts/patches.

this one uses update_sql for the sequences queries rather than db_query

seems like the autoincrement is duplicating the patch on #333769: imagecache_preset needs auto increment?

marked the other as a duplicate of this issue.

Status:Needs review» Needs work

seems like the delete query could go inside the for loop...

patch at #6 didn't fix the problem here.. running update.php performs the new updates, but i am still getting the warning

user warning: Unknown column 'module' in 'field list' query: UPDATE imagecache_action SET presetid = 3, weight = 0, module = 'imagecache', action = 'imagecache_scale_and_crop', data = 'a:2:{s:5:"width";s:2:"80";s:6:"height";s:2:"60";}' WHERE actionid = 3 in /Users/user/site/includes/common.inc on line 3418.

I just applied the patch at #4, and I can now add presets again. I am still unable to add actions to the presets. I do not get an error message. After clicking "Add Action" I am returned to the preset's screen with only the "Add Actions" dropdown showing. Any ideas?

I have the same experience as @SlipAngel exactly - I can create the preset name, but after creating and clicking "add action" for any given preset, I am returned to the Actions interface without a preset action. Preset actions from my 6.x ubercart installation are there, but I can't add any new preset actions.

I got it working after applying the patch #4, running update.php and adding this database column manually, as suggested in http://drupal.org/node/331858#comment-1099296 :

ALTER TABLE imagecache_action ADD module VARCHAR(255) AFTER weight;

Status:Needs work» Needs review
new1.74 KB

Here's a new patch that addresses the missing module column. I used schema.module to figure out what else might be missing and noticed that the presetid index was also missing.

Another serious problem that I found is that imagecache_update_4() is missing a break after the mysql/mysqli case, causing the postgres case to also run. This created a couple of errors during my update. I've added the break and all seems to be working.

new1.85 KB

just noticed from the duplicate issue that the module field should also be populated with 'imagecache'.

new patch to fix it.

Status:Needs review» Needs work

you cannot call:

+  $schema = imagecache_schema();

in an update function. think about it for a second, what happens when we update the schema and someone who's upgrading from D5 runs this? they'll be getting a current copy of the schema and updates after this will fail. you need to put a full copy of the field in the update function.

we don't need:

+  $ret[] = update_sql("UPDATE {imagecache_action} set module = 'imagecache'");

because db_add_field() will look in the $spec parameter for the key 'initial' which will be used to fill the newly created field.

also the break in update_4() has been committed in another patch.

new2.28 KB

here's an untested patch.

Status:Needs work» Fixed
new2.3 KB

okay, tested this and i'm satisfied. committed to HEAD.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.