You are here

function path_redirect_update_4 in Path redirect 5

Same name and namespace in other branches
  1. 6 path_redirect.install \path_redirect_update_4()

Allow longer values for query strings fix the primary and unique keys.

File

./path_redirect.install, line 126
Install and uninstall schema and functions for the path_redirect module.

Code

function path_redirect_update_4() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {path_redirect} MODIFY query varchar(255) NOT NULL");
      $ret[] = update_sql("ALTER TABLE {path_redirect} DROP PRIMARY KEY");
      $ret[] = update_sql("ALTER TABLE {path_redirect} DROP KEY rid");
      $ret[] = update_sql("ALTER TABLE {path_redirect} ADD PRIMARY KEY (rid)");
      $ret[] = update_sql("ALTER TABLE {path_redirect} ADD UNIQUE KEY (path)");
      break;
    case 'pgsql':
      db_change_column($ret, 'path_redirect', 'query', 'query', 'varchar(255)');
      $ret[] = update_sql("ALTER TABLE {path_redirect} DROP CONSTRAINT {path_redirect}_pkey");
      $ret[] = update_sql("ALTER TABLE {path_redirect} DROP CONSTRAINT {path_redirect}_rid_key");
      $ret[] = update_sql("ALTER TABLE {path_redirect} ADD PRIMARY KEY (rid)");
      $ret[] = update_sql("ALTER TABLE {path_redirect} ADD UNIQUE (path)");
      break;
  }
  return $ret;
}