You are here

function system_update_113 in Drupal 5

Same name and namespace in other branches
  1. 4 database/updates.inc \system_update_113()

File

modules/system/system.install, line 1233

Code

function system_update_113() {
  $ret = array();
  if ($GLOBALS['db_type'] == 'mysql') {
    $ret[] = update_sql('ALTER TABLE {accesslog} ADD aid int NOT NULL auto_increment, ADD PRIMARY KEY (aid)');
  }
  elseif ($GLOBALS['db_type'] == 'pgsql') {
    $ret[] = update_sql("SELECT * INTO TEMPORARY {accesslog}_t FROM {accesslog}");
    $ret[] = update_sql("DROP TABLE {accesslog}");
    $ret[] = update_sql("CREATE TABLE {accesslog} (\n      aid serial,\n      title varchar(255) default NULL,\n      path varchar(255) default NULL,\n      url varchar(255) default NULL,\n      hostname varchar(128) default NULL,\n      uid integer default '0',\n      timestamp integer NOT NULL default '0'\n    )");
    $ret[] = update_sql("INSERT INTO {accesslog} (title, path, url, hostname, uid, timestamp) SELECT title, path, url, hostname, uid, timestamp FROM {accesslog}_t");
    $ret[] = update_sql("DROP TABLE {accesslog}_t");
    $ret[] = update_sql("CREATE INDEX {accesslog}_timestamp_idx ON {accesslog} (timestamp);");
  }

  // Flush the menu cache:
  cache_clear_all('*', 'cache_menu', TRUE);
  return $ret;
}