You are here

og_menu.install in Organic Groups Menu (OG Menu) 5

File

og_menu.install
View source
<?php

// og_menu.install
function og_menu_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':

      // the {tablename} syntax is so multisite installs can add a
      // prefix to the table name as set in the settings.php file
      db_query("CREATE TABLE {og_menu} (\n          mid int unsigned NOT NULL default '0',\n          gid int unsigned NOT NULL default '0',\n          is_primary tinyint unsigned NOT NULL default '0',\n          parent_mid int unsigned NOT NULL default '0',\n          weight int NOT NULL default '0',\n          PRIMARY KEY  (mid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {og_menu} (\n          mid integer NOT NULL default '0' CHECK (mid >= 0),\n          gid  integer NOT NULL default '0' CHECK (gid >= 0),\n          is_primary integer NOT NULL default '0' CHECK (is_primary >= 0),\n          parent_mid integer NOT NULL default '0' CHECK (parent_mid >= 0),\n          weight integer NOT NULL default '0',\n          PRIMARY KEY  (mid)\n        )");

      // Pgsql requires keys and indexes to be defined separately.
      // It's important to name the index as {tablename}_fieldname_idx
      // (the trailing _idx!) so update scripts can be written easily
      db_query("CREATE INDEX {og_menu}_mid_idx\n                ON {og_menu} (mid)");
      break;
  }
}

Functions

Namesort descending Description
og_menu_install