You are here

function ad_image_install in Advertisement 5

Same name and namespace in other branches
  1. 5.2 image/ad_image.install \ad_image_install()
  2. 6.3 image/ad_image.install \ad_image_install()
  3. 6 image/ad_image.install \ad_image_install()
  4. 6.2 image/ad_image.install \ad_image_install()
  5. 7 image/ad_image.install \ad_image_install()

Ad_image module database schema. Copyright (c) 2005-2006 Jeremy Andrews <jeremy@kerneltrap.org>. All rights reserved.

File

image/ad_image.install, line 9

Code

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

      /**
       * The ad_image_format table provides format guidelines for a given group
       * of image ads.
       */
      db_query("CREATE TABLE {ad_image_format} (\n        gid INT NOT NULL UNIQUE PRIMARY KEY,\n\n        min_width INT NOT NULL DEFAULT '0',\n        max_width INT NOT NULL DEFAULT '0',\n        min_height INT NOT NULL DEFAULT '0',\n        max_height INT NOT NULL DEFAULT '0'\n      );");

      /**
       * The ad_image table stores information about each image ad.
       */
      db_query("CREATE TABLE {ad_image} (\n        aid INT NOT NULL DEFAULT '0' UNIQUE,\n        fid INT NOT NULL DEFAULT '0',\n \n        url VARCHAR(255) NOT NULL DEFAULT '',\n        tooltip VARCHAR(255) NOT NULL DEFAULT '',\n        width INT NOT NULL DEFAULT '0',\n        height INT NOT NULL DEFAULT '0'\n      );");
      break;
    case 'mysql':
    case 'mysqli':
    default:

      /**
       * The ad_image_format table provides format guidelines for a given group
       * of image ads.
       */
      db_query("CREATE TABLE {ad_image_format} (\n        gid INT(10) UNSIGNED NOT NULL,\n\n        min_width INT(5) UNSIGNED NOT NULL DEFAULT '0',\n        max_width INT(5) UNSIGNED NOT NULL DEFAULT '0',\n        min_height INT(5) UNSIGNED NOT NULL DEFAULT '0',\n        max_height INT(5) UNSIGNED NOT NULL DEFAULT '0',\n\n        PRIMARY KEY (gid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");

      /**
       * The ad_image table stores information about each image ad.
       */
      db_query("CREATE TABLE {ad_image} (\n        aid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n        fid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n\n        url VARCHAR(255) NOT NULL DEFAULT '',\n        tooltip VARCHAR(255) NOT NULL DEFAULT '',\n        width INT UNSIGNED NOT NULL DEFAULT '0',\n        height INT UNSIGNED NOT NULL DEFAULT '0',\n\n        UNIQUE KEY (aid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
  }
  drupal_set_message(t('The necessary ad_image module tables have been created.'));
}