You are here

function signup_update_5200 in Signup 6

Same name and namespace in other branches
  1. 5.2 signup.install \signup_update_5200()
  2. 6.2 signup.install \signup_update_5200()

Convert the misnamed "completed" column to "status" (and swap all the values: 0 == closed, 1 == open).

File

./signup.install, line 265

Code

function signup_update_5200() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {signup} ADD status int NOT NULL default '1'");
      break;
    case 'pgsql':
      db_add_column($ret, 'signup', 'status', 'integer', array(
        'not null' => TRUE,
        'default' => "'1'",
      ));
      break;
  }
  $ret[] = update_sql("UPDATE {signup} SET status = (1 - completed)");
  $ret[] = update_sql("ALTER TABLE {signup} DROP completed");
  return $ret;
}