You are here

function og_install in Organic groups 5.2

Same name and namespace in other branches
  1. 5.8 og.install \og_install()
  2. 5 og.install \og_install()
  3. 5.3 og.install \og_install()
  4. 5.7 og.install \og_install()
  5. 6.2 og.install \og_install()
  6. 6 og.install \og_install()
  7. 7.2 og.install \og_install()
  8. 7 og.install \og_install()

File

./og.install, line 3

Code

function og_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {og} (\n        nid int(11) NOT NULL,\n        selective int(11) NOT NULL default '0',\n        description varchar(255) NULL,\n        theme varchar(255) NULL,\n        website varchar(255) NULL,\n        register int(1) NOT NULL default 0,\n        directory int(1) NOT NULL default 0,\n        notification int(1) NOT NULL default 0,\n        language varchar(12) NOT NULL default '',\n        PRIMARY KEY  (nid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {og_uid} (\n        nid int(11) NOT NULL,\n        og_role int(1) NOT NULL DEFAULT 0,\n        is_active int(1) NOT NULL DEFAULT 0,\n        is_admin int(1) NOT NULL DEFAULT 0,\n        uid int(11) NOT NULL,\n        mail_type int(11) NULL,\n      \tcreated int(11) NULL DEFAULT 0,\n      \tchanged int(11) NULL DEFAULT 0,\n        PRIMARY KEY  (nid, uid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {og_uid_global} (\n        uid int(11) NOT NULL,\n        og_email int(11) NOT NULL DEFAULT 2,\n        PRIMARY KEY  (uid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {og_ancestry} (\n        nid int(11) NOT NULL,\n        group_nid int(11) NOT NULL,\n        is_public int(1) NOT NULL,\n        KEY  (nid),\n        KEY  (group_nid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {og} (\n        nid numeric(11) NOT NULL,\n        selective numeric(11) NOT NULL default 0,\n        description varchar(255) NULL,\n        theme varchar(255) NULL,\n        website varchar(255) NULL,\n        register numeric(1) NOT NULL default 0,\n        directory numeric(1) NOT NULL default 0,\n        notification numeric(1) NOT NULL default 0,\n        language varchar(12) NOT NULL default '',\n        PRIMARY KEY  (nid)\n      );");
      db_query("CREATE TABLE {og_uid} (\n        nid numeric(11) NOT NULL,\n        og_role numeric(1) NOT NULL DEFAULT 0,\n        is_active numeric(1) NOT NULL DEFAULT 0,\n        is_admin numeric(1) NOT NULL DEFAULT 0,\n        uid numeric(11) NOT NULL,\n        mail_type numeric(11) NULL,\n\tcreated numeric(11) NULL DEFAULT 0,\n\tchanged numeric(11) NULL DEFAULT 0,\n        PRIMARY KEY  (nid, uid)\n      );");
      db_query("CREATE TABLE {og_uid_global} (\n        uid numeric(11) NOT NULL,\n        og_email numeric(11) NULL DEFAULT 2,\n        PRIMARY KEY (uid)\n      );");
      db_query("\n      CREATE TABLE {og_ancestry} (\n       nid numeric(11) NOT NULL,\n       group_nid numeric(11) NOT NULL,\n       is_public numeric(1) NOT NULL,\n       PRIMARY KEY  (nid)\n      );\n      CREATE INDEX {og_ancestry}_nid_idx ON {og_ancestry}(group_nid);\n      ");
      break;
  }
  drupal_set_message(t('Organic groups module enabled. Please see the included readme.txt file for further installation instructions.'));
}