You are here

function ad_channel_install in Advertisement 5.2

Same name and namespace in other branches
  1. 6.3 channel/ad_channel.install \ad_channel_install()
  2. 6.2 channel/ad_channel.install \ad_channel_install()
  3. 7 channel/ad_channel.install \ad_channel_install()

Create the ad_channel schema.

File

channel/ad_channel.install, line 12

Code

function ad_channel_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    default:

      // TODO: PostgreSQL support.  Patches welcome.

      /* The ad_channel table stores channel definitions and rules.
       */
      db_query("CREATE TABLE {ad_channel} (\n        chid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n        name VARCHAR(64) NOT NULL DEFAULT '',\n        description LONGTEXT NULL,\n        conid INT(11) UNSIGNED NOT NULL DEFAULT '0',\n        weight TINYINT(4) SIGNED NOT NULL DEFAULT '0',\n        display TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',\n        urls TEXT NULL,\n        groups TEXT NULL,\n        PRIMARY KEY  (chid),\n        KEY  (name)\n      );");

      /* The ad_channel_container table stores channel container definitions.
       */
      db_query("CREATE TABLE {ad_channel_container} (\n        conid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n        name VARCHAR(64) NOT NULL DEFAULT '',\n        description LONGTEXT NULL,\n        weight TINYINT(4) SIGNED NOT NULL DEFAULT '0',\n        PRIMARY KEY  (conid)\n      );");

      /* The ad_channel_node table stores per node channel information.
       */
      db_query("CREATE TABLE {ad_channel_node} (\n        chid INT(11) UNSIGNED NOT NULL DEFAULT '0',\n        nid INT(11) UNSIGNED NOT NULL DEFAULT '0',\n        PRIMARY KEY  (chid, nid),\n        KEY (nid, chid)\n      );");

      /* The ad_channel_node table stores per node channel information.
       */
      db_query("CREATE TABLE {ad_priority} (\n        aid INT(11) UNSIGNED NOT NULL DEFAULT '0',\n        priority TINYINT UNSIGNED NOT NULL DEFAULT '0',\n        PRIMARY KEY  (aid, priority)\n      );");
  }
}