You are here

function system_update_180 in Drupal 5

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

File

modules/system/system.install, line 3019

Code

function system_update_180() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {node} DROP PRIMARY KEY");
      $ret[] = update_sql("ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)");
      $ret[] = update_sql("ALTER TABLE {node} DROP INDEX vid");
      $ret[] = update_sql("ALTER TABLE {node} ADD UNIQUE (vid)");
      $ret[] = update_sql("ALTER TABLE {node} ADD INDEX (nid)");
      $ret[] = update_sql("ALTER TABLE {node_counter} CHANGE nid nid int NOT NULL DEFAULT '0'");
      break;
    case 'pgsql':
      $ret[] = update_sql("ALTER TABLE {node} DROP CONSTRAINT {node}_pkey");

      // Change PK
      $ret[] = update_sql("ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)");
      $ret[] = update_sql('DROP INDEX {node}_vid_idx');

      // Change normal index to UNIQUE index
      $ret[] = update_sql('CREATE UNIQUE INDEX {node}_vid_idx ON {node}(vid)');
      $ret[] = update_sql('CREATE INDEX {node}_nid_idx ON {node}(nid)');

      // Add index on nid
      break;
  }
  return $ret;
}