You are here

function book_access_install in Book access 5

Same name and namespace in other branches
  1. 6.2 book_access.install \book_access_install()
  2. 6 book_access.install \book_access_install()
  3. 7.2 book_access.install \book_access_install()

Implements hook_install().

File

./book_access.install, line 21

Code

function book_access_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("\n        CREATE TABLE IF NOT EXISTS {book_access} (\n          nid 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          KEY nid (nid),\n          KEY rid (rid)\n        );\n      ");
      break;
    case 'pgsql':
      db_query("\n        CREATE TABLE {book_access} (\n          nid 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          PRIMARY KEY (nid, rid)\n        );\n      ");
      break;
  }
  db_query("UPDATE {system} SET weight = 2 WHERE name = 'book_access'");
}