You are here

function quotes_update_2 in Quotes 5

Implementation of hook_update_N(). Adds vid column to quotes table.

File

./quotes.install, line 156
Handles installation and updates for the quotes module.

Code

function quotes_update_2() {
  global $db_type;
  $items = array();
  $items[] = update_sql('ALTER TABLE {quotes} ADD vid INTEGER NOT NULL');
  $items[] = update_sql('UPDATE {quotes} SET vid = nid');
  if ($db_type == 'pgsql') {
    $items[] = update_sql('ALTER TABLE {quotes} DROP CONSTRAINT {quotes}_pkey');
  }
  else {
    $items[] = update_sql('ALTER TABLE {quotes} DROP PRIMARY KEY');
  }
  $items[] = update_sql('ALTER TABLE {quotes} ADD PRIMARY KEY (nid, vid)');
  return $items;
}