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;
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drewish’s picture

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

zroger’s picture

Title: SQL-error when creating new action » Update function from 5.x -> 6.x
Version: 6.x-1.0-alpha2 » 6.x-2.0-beta3
Status: Needs work » Needs review
FileSize
1009 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.

zroger’s picture

FileSize
1.15 KB

new patch also removes imagecache entries in the sequences table

zroger’s picture

FileSize
1.17 KB

sorry for so many posts/patches.

this one uses update_sql for the sequences queries rather than db_query

drewish’s picture

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

drewish’s picture

marked the other as a duplicate of this issue.

drewish’s picture

Status: Needs review » Needs work

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

marcoBauli’s picture

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.
SlipAngel’s picture

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?

ravenGR’s picture

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.

trupalizer’s picture

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;

zroger’s picture

Status: Needs work » Needs review
FileSize
1.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.

zroger’s picture

FileSize
1.85 KB

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

new patch to fix it.

drewish’s picture

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.

drewish’s picture

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

drewish’s picture

FileSize
2.28 KB

here's an untested patch.

drewish’s picture

Status: Needs work » Fixed
FileSize
2.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.