You are here

function ad_notify_install in Advertisement 5.2

Same name and namespace in other branches
  1. 5 notify/ad_notify.install \ad_notify_install()
  2. 6 notify/ad_notify.install \ad_notify_install()

Ad_notify module database schema. Copyright (c) 2007 Jeremy Andrews <jeremy@kerneltrap.org> All rights reserved.

File

notify/ad_notify.install, line 8

Code

function ad_notify_install() {
  switch ($GLOBALS['db_type']) {
    case 'pgsql':

      /**
       * Notifications can be granted to each owner of each ad.  The same owner
       * can own multiple ads, and can have different notifications for each
       * ad.  Notifications are defined by their type and an offset in seconds.
       * For example, 'day, 0' would send a notification at the start of
       * every day, and 'expire, -86400' would send a notification one day
       * before the ad expires.
       */
      db_query("CREATE TABLE {ad_notify} (\n      notid SERIAL NOT NULL PRIMARY KEY,\n      aid INT NOT NULL DEFAULT '0',\n      oid INT NOT NULL DEFAULT '0',\n\n      event VARCHAR(255) NOT NULL DEFAULT '',\n      delay INT NOT NULL DEFAULT '0',\n      queued INT NOT NULL DEFAULT '0',\n      time INT NOT NULL DEFAULT '0',\n      sent INT NOT NULL DEFAULT '0',\n      counter INT NOT NULL DEFAULT '0',\n      locked INT NOT NULL DEFAULT '0',\n      expire INT NOT NULL DEFAULT '0',\n      status INT NOT NULL DEFAULT '0',\n\n      address VARCHAR(255) NOT NULL DEFAULT '',\n      subject VARCHAR(255) NOT NULL DEFAULT '',\n      body TEXT NOT NULL DEFAULT '',\n\n      UNIQUE (oid, event, delay)\n      );");
      break;
    case 'mysql':
    case 'mysqli':
    default:

      /**
       * Notifications can be granted to each owner of each ad.  The same owner
       * can own multiple ads, and can have different notifications for each
       * ad.  Notifications are defined by their type and an offset in seconds.
       * For example, 'day, 0' would send a notification at the start of
       * every day, and 'expire, -86400' would send a notification one day
       * before the ad expires.
       */
      db_query("CREATE TABLE {ad_notify} (\n      notid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n      aid INT(11) UNSIGNED NOT NULL DEFAULT '0',\n      oid INT(11) UNSIGNED NOT NULL DEFAULT '0',\n\n      event VARCHAR(255) NOT NULL DEFAULT '',\n      delay INT(11) SIGNED NOT NULL DEFAULT '0',\n      queued INT(11) SIGNED NOT NULL DEFAULT '0',\n      sent INT(11) SIGNED NOT NULL DEFAULT '0',\n      counter INT(7) UNSIGNED NOT NULL DEFAULT '0',\n      locked TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',\n      expire TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',\n      status TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',\n\n      address VARCHAR(255) NOT NULL DEFAULT '',\n      subject VARCHAR(255) NOT NULL DEFAULT '',\n      body TEXT NULL,\n\n      PRIMARY KEY  (notid),\n      UNIQUE KEY  (oid, event, delay),\n      KEY  (oid),\n      KEY  (event),\n      KEY  (delay),\n      KEY  (queued),\n      KEY  (sent),\n      KEY  (status)\n    ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
  }
  drupal_set_message(t('The ad_notify table has been created.'));
}