Skip to content
Snippets Groups Projects
updates.inc 71.9 KiB
Newer Older

/**
 * The lid field in pgSQL should not be UNIQUE, but an INDEX.
 */
function system_update_182() {
  $ret = array();

  if ($GLOBALS['db_type'] == 'pgsql') {
    $ret[] = update_sql('ALTER TABLE {locales_target} DROP CONSTRAINT {locales_target}_lid_key');
    $ret[] = update_sql('CREATE INDEX {locales_target}_lid_idx ON {locales_target} (lid)');
  }

  return $ret;
}

function system_update_183() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    $ret[] = update_sql("CREATE TABLE {blocks_roles} (
      module varchar(64) NOT NULL,
      delta varchar(32) NOT NULL,
      rid int(10) unsigned NOT NULL,
      PRIMARY KEY (module, delta, rid)
      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
    break;

    case 'pgsql':
    $ret[] = update_sql("CREATE TABLE {blocks_roles} (
      module varchar(64) NOT NULL,
      delta varchar(32) NOT NULL,
      rid integer NOT NULL,
      PRIMARY KEY (module, delta, rid)
      );");
    break;

  }
  return $ret;
}

function system_update_184() {
  // change DB schema for better poll support
  $ret = array();

  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      // alter poll_votes table
      $ret[] = update_sql("ALTER TABLE {poll_votes} ADD COLUMN chorder int(10) NOT NULL default -1 AFTER uid");
      break;

    case 'pgsql':
      db_add_column($ret, 'poll_votes', 'chorder', 'int', array('not null' => TRUE, 'default' => "'-1'"));
      break;
  }

  return $ret;
}

function system_update_185() {
  // Make the forum's vocabulary the highest in list, if present
  $ret = array();

  if ($vid = (int) variable_get('forum_nav_vocabulary', 0)) {
    $ret[] = update_sql('UPDATE {vocabulary} SET weight = -10 WHERE vid = '. $vid);