You are here

function imagecache_update_2 in ImageCache 6.2

Same name and namespace in other branches
  1. 5.2 imagecache.install \imagecache_update_2()
  2. 5 imagecache.install \imagecache_update_2()

File

./imagecache.install, line 144

Code

function imagecache_update_2() {
  $ret = array();
  $ret[] = update_sql('ALTER TABLE {imagecache_rulesets} RENAME TO {imagecache_preset}');
  $ret[] = update_sql('ALTER TABLE {imagecache_actions} RENAME TO {imagecache_action}');
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql('ALTER TABLE {imagecache_preset} CHANGE rulesetid presetid INT UNSIGNED NOT NULL AUTO_INCREMENT');
      $ret[] = update_sql('ALTER TABLE {imagecache_preset} CHANGE rulesetname presetname VARCHAR(255) NOT NULL DEFAULT \'\'');
      $ret[] = update_sql('ALTER TABLE {imagecache_action} CHANGE rulesetid presetid  INTEGER NOT NULL DEFAULT 0');
      break;
    case 'pgsql':
      $ret[] = update_sql('ALTER TABLE {imagecache_preset} RENAME COLUMN rulesetid TO presetid');
      $ret[] = update_sql('ALTER TABLE {imagecache_preset} RENAME COLUMN rulesetname TO presetname');
      $ret[] = update_sql('ALTER TABLE {imagecache_action} RENAME COLUMN rulesetid TO presetid');
      break;
  }
  return $ret;
}