You are here

function advpoll_update_4 in Advanced Poll 5

Same name and namespace in other branches
  1. 6 advpoll.install \advpoll_update_4()
  2. 6.2 advpoll.install \advpoll_update_4()

Add columns for write-in support.

File

./advpoll.install, line 193

Code

function advpoll_update_4() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {advpoll} ADD writeins tinyint NOT NULL default '0'");
      $ret[] = update_sql("ALTER TABLE {advpoll} ADD show_writeins tinyint NOT NULL default '0'");
      $ret[] = update_sql("ALTER TABLE {advpoll_choices} ADD writein tinyint NOT NULL default '0'");
      break;
    case 'pgsql':
      db_add_column($ret, 'advpoll', 'writeins', 'smallint', array(
        'default' => 0,
        'not null' => TRUE,
      ));
      db_add_column($ret, 'advpoll', 'show_writeins', 'smallint', array(
        'default' => 0,
        'not null' => TRUE,
      ));
      db_add_column($ret, 'advpoll_choices', 'writein', 'smallint', array(
        'default' => 0,
        'not null' => TRUE,
      ));
      break;
  }
  return $ret;
}