You are here

function birthdays_install in Birthdays 5

Same name and namespace in other branches
  1. 6 birthdays.install \birthdays_install()

Implementation of hook_install().

File

./birthdays.install, line 6

Code

function birthdays_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE IF NOT EXISTS {dob} (\n        uid int(10) unsigned NOT NULL default 0,\n        birthday date NOT NULL default '0000-00-00',\n        PRIMARY KEY (uid)\n        );");

      // fetch current weight of the profile module, decrease with 1;
      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        );");
      break;
  }
  $weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'profile'")) - 1;
  db_query("UPDATE {system} SET weight = %d WHERE name = 'birthdays'", $weight);
}