### Eclipse Workspace Patch 1.0
#P drupal
Index: modules/imagecache/imagecache.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.install,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 imagecache.install
--- modules/imagecache/imagecache.install	17 Oct 2006 06:29:25 -0000	1.2.2.3
+++ modules/imagecache/imagecache.install	17 Oct 2006 06:41:06 -0000
@@ -7,14 +7,16 @@
     case 'mysqli':
       $ret1 = db_query('CREATE TABLE {imagecache_preset} (
             presetid INT UNSIGNED NOT NULL PRIMARY KEY,
-            presetname VARCHAR(255) NOT NULL DEFAULT \'\' )'
+            presetname VARCHAR(255) NOT NULL DEFAULT \'\' )
+            TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */'
       );
 
       $ret2 = db_query('CREATE TABLE {imagecache_action} (
             actionid INT UNSIGNED NOT NULL PRIMARY KEY,
             presetid INT UNSIGNED NOT NULL DEFAULT 0,
             weight INT NOT NULL DEFAULT 0,
-            data TEXT NOT NULL DEFAULT \'\');'
+            data TEXT NOT NULL DEFAULT \'\')
+            TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */'
       );
       break;
 
@@ -31,6 +33,8 @@
             data TEXT NOT NULL DEFAULT \'\',
             PRIMARY KEY (actionid));'
       );
+      db_query("CREATE SEQUENCE imagecache_rulesets_rulesetid_seq INCREMENT 1 START 1;");
+      db_query("CREATE SEQUENCE imagecache_actions_actionid_seq INCREMENT 1 START 1;");
       break;
   }
 
@@ -77,24 +81,28 @@
  */  
 function imagecache_update_3() {
   $ret = array();
+  
+  $count_action = db_result(db_query('SELECT max(actionid) FROM {imagecache_actions}')) + 1;
+  $count_ruleset = db_result(db_query('SELECT max(rulesetid) FROM {imagecache_rulesets}')) + 1;
+  
   switch ($GLOBALS['db_type']) {
     case 'mysql':
     case 'mysqli':
-      $ret[] = update_sql('ALTER TABLE {imagecache_action} CHANGE actionid actionid INT UNSIGNED NOT NULL');
-      $ret[] = update_sql('ALTER TABLE {imagecache_preset} CHANGE presetid presetid INT UNSIGNED NOT NULL');
+      $ret[] = update_sql("ALTER TABLE {imagecache_actions} CHANGE actionid actionid INT UNSIGNED NOT NULL");
+      $ret[] = update_sql("ALTER TABLE {imagecache_rulesets} CHANGE rulesetid rulesetid INT UNSIGNED NOT NULL");
+      // Add the sequences
+      $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{imagecache_actions}_actionid',$count_action)");
+      $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{imagecache_rulesets}_rulesetid',$count_ruleset)");
       break;
     case 'pgsql':
-      db_change_column($ret, 'imagecache_action', 'actionid', 'actionid', 'INT', $attributes = array('not null' => TRUE, 'default' => '0'));
-      db_change_column($ret, 'imagecache_preset', 'presetid', 'presetid', 'INT', $attributes = array('not null' => TRUE, 'default' => '0'));
+      db_change_column($ret, 'imagecache_actions', 'actionid', 'actionid', 'INT', $attributes = array('not null' => TRUE, 'default' => '0'));
+      db_change_column($ret, 'imagecache_rulesets', 'rulesetid', 'rulesetid', 'INT', $attributes = array('not null' => TRUE, 'default' => '0'));
       // Re-add our indexes
-      $ret[] = update_sql("ALTER TABLE {imagecache_action} ADD PRIMARY KEY (actionid)");
-      $ret[] = update_sql("ALTER TABLE {imagecache_preset} ADD PRIMARY KEY (presetid)");
-      break;
-  }   
-  // Create the columns in the sequences table
-  $count_action = db_result(db_query('SELECT max(actionid) FROM {imagecache_action}'));
-  $count_preset = db_result(db_query('SELECT max(presetid) FROM {imagecache_preset}'));
-  $ret[] = update_sql('INSERT INTO {sequences} (name, id) VALUES (\'{imagecache_action}_actionid\',' . $count_action .')');
-  $ret[] = update_sql('INSERT INTO {sequences} (name, id) VALUES (\'{imagecache_preset}_presetid\',' . $count_preset .')');
+      $ret[] = update_sql("ALTER TABLE {imagecache_actions} ADD PRIMARY KEY (actionid)");
+      $ret[] = update_sql("ALTER TABLE {imagecache_rulesets} ADD PRIMARY KEY (rulesetid)");
+      // Add the sequences
+      $ret[] = update_sql("CREATE SEQUENCE {imagecache_actions}_actionid_seq INCREMENT 1 START $count_action;");
+      $ret[] = update_sql("CREATE SEQUENCE {imagecache_rulesets}_rulesetid_seq INCREMENT 1 START $count_ruleset;");
+  }
   return $ret;
 }
