You are here

function signup_update_5201 in Signup 5.2

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

Add the close_signup_limit field to the {signup} table to allow signup limits for sites that upgraded from 4.6.x. The original signup.install for 4.7.x accidentally included this column in the DB, but it's never been used in the code until now. However, sites that upgraded from 4.6.x need this column for the module to work, so just to be safe, we also add that here.

File

./signup.install, line 230

Code

function signup_update_5201() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      if (!_signup_db_column_exists('signup', 'close_signup_limit')) {
        $ret[] = update_sql("ALTER TABLE {signup} ADD close_signup_limit int(10) unsigned NOT NULL default '0'");
      }
      break;
    case 'pgsql':
      if (!_signup_db_column_exists('signup', 'close_signup_limit')) {
        db_add_column($ret, 'signup', 'close_signup_limit', 'integer', array(
          'not null' => TRUE,
          'default' => "'0'",
        ));
      }
      break;
  }
  return $ret;
}