You are here

function forum_access_install in Forum Access 5

Same name and namespace in other branches
  1. 8 forum_access.install \forum_access_install()
  2. 6 forum_access.install \forum_access_install()
  3. 7 forum_access.install \forum_access_install()

File

./forum_access.install, line 3

Code

function forum_access_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE IF NOT EXISTS {forum_access} (\n        tid int(10) NOT NULL default 0,\n        rid int(10) NOT NULL default 0,\n        grant_view tinyint(1) unsigned NOT NULL default '0',\n        grant_update tinyint(1) unsigned NOT NULL default '0',\n        grant_delete tinyint(1) unsigned NOT NULL default '0',\n        grant_create tinyint(1) unsigned NOT NULL default '0',\n        priority smallint NOT NULL default 0,\n        KEY tid (tid),\n        KEY rid (rid)\n      );");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {forum_access} (\n        tid int NOT NULL DEFAULT 0,\n        rid int NOT NULL DEFAULT 0,\n        grant_view smallint NOT NULL DEFAULT 0,\n        grant_update smallint  NOT NULL DEFAULT 0,\n        grant_delete smallint NOT NULL DEFAULT 0,\n        grant_create smallint NOT NULL DEFAULT 0,\n        priority smallint NOT NULL DEFAULT 0,\n        PRIMARY KEY (tid, rid)\n      );");
      break;
  }
  db_query("UPDATE {system} SET weight = 2 WHERE name = 'forum_access'");
}