You are here

function acl_install in ACL 5

Same name and namespace in other branches
  1. 6 acl.install \acl_install()

File

./acl.install, line 3

Code

function acl_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("create table if not exists {acl} (\n        acl_id int(10) NOT NULL default 0,\n        module varchar(255),\n        name varchar(255),\n        PRIMARY KEY (acl_id)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("create table if not exists {acl_user} (\n        acl_id int(10) NOT NULL default 0,\n        uid int(10) NOT NULL default 0,\n        PRIMARY KEY (acl_id, uid),\n        KEY uid (uid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("create table if not exists {acl_node} (\n        acl_id int(10) NOT NULL default 0,\n        nid 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        priority smallint(2) NOT NULL default '0',\n        PRIMARY KEY (acl_id, nid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {acl} (\n        acl_id integer NOT NULL DEFAULT 0,\n        module varchar(255),\n        name varchar(255),\n        PRIMARY KEY (acl_id)\n      );");
      db_query("CREATE SEQUENCE {acl}_acl_id_seq;");
      db_query("CREATE TABLE {acl_user} (\n        acl_id integer NOT NULL DEFAULT 0,\n        uid int NOT NULL DEFAULT 0,\n        PRIMARY KEY (acl_id, uid)\n      );");
      db_query("CREATE INDEX {acl_user}_uid_index ON {acl_user} (uid)");
      db_query("CREATE TABLE {acl_node} (\n        acl_id integer NOT NULL DEFAULT 0,\n        nid 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        priority smallint NOT NULL default 0,\n        PRIMARY KEY (acl_id, nid)\n      );");
      break;
  }
}