You are here

function birthdays_update_2 in Birthdays 5

Implementation of hook_update_N().

File

./birthdays.install, line 57

Code

function birthdays_update_2() {

  // 2008-04-09: Postgresql added
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      break;
    case 'pgsql':
      db_query("CREATE TABLE  {dob} (\n        uid int NOT NULL default 0 check(uid >= 0),\n        birthday date NOT NULL default '0000-01-01',\n        PRIMARY KEY (uid)\n        );");

      // fetch current weight of the profile module, decrease with 1;
      $weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'profile'")) - 1;
      $ret[] = update_sql("UPDATE {system} SET weight = %d WHERE name = 'birthdays'", $weight);
      break;
  }
  return $ret;
}