You are here

function userpoints_update_2 in User Points 5.3

Same name and namespace in other branches
  1. 5 userpoints.install \userpoints_update_2()
  2. 5.2 userpoints.install \userpoints_update_2()
  3. 6 userpoints.install \userpoints_update_2()

File

./userpoints.install, line 100

Code

function userpoints_update_2() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':

      // Add the max_points column
      $ret[] = update_sql("ALTER TABLE {userpoints} ADD COLUMN max_points INT(10) NOT NULL DEFAULT '0' AFTER points");

      // Make the points column bigger
      $ret[] = update_sql("ALTER TABLE {userpoints} CHANGE points points INT(10) NOT NULL DEFAULT '0'");
      break;
    case 'pgsql':

      // Add the max_points column
      $ret[] = update_sql("ALTER TABLE {userpoints} ADD COLUMN max_points INT(10) SET NOT NULL DEFAULT '0' AFTER points");

      // Make the points column bigger
      $ret[] = update_sql("ALTER TABLE {userpoints} ALTER COLUMN points TYPE INT(10) SET NOT NULL DEFAULT '0'");
  }
  return $ret;
}