You are here

aggregator.install in Drupal 5

File

modules/aggregator/aggregator.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function aggregator_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {aggregator_category} (\n        cid int NOT NULL auto_increment,\n        title varchar(255) NOT NULL default '',\n        description longtext NOT NULL,\n        block tinyint NOT NULL default '0',\n        PRIMARY KEY (cid),\n        UNIQUE KEY title (title)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {aggregator_category_feed} (\n        fid int NOT NULL default '0',\n        cid int NOT NULL default '0',\n        PRIMARY KEY (fid,cid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {aggregator_category_item} (\n        iid int NOT NULL default '0',\n        cid int NOT NULL default '0',\n        PRIMARY KEY (iid,cid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {aggregator_feed} (\n        fid int NOT NULL auto_increment,\n        title varchar(255) NOT NULL default '',\n        url varchar(255) NOT NULL default '',\n        refresh int NOT NULL default '0',\n        checked int NOT NULL default '0',\n        link varchar(255) NOT NULL default '',\n        description longtext NOT NULL,\n        image longtext NOT NULL,\n        etag varchar(255) NOT NULL default '',\n        modified int NOT NULL default '0',\n        block tinyint NOT NULL default '0',\n        PRIMARY KEY (fid),\n        UNIQUE KEY link (url),\n        UNIQUE KEY title (title)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {aggregator_item} (\n        iid int NOT NULL auto_increment,\n        fid int NOT NULL default '0',\n        title varchar(255) NOT NULL default '',\n        link varchar(255) NOT NULL default '',\n        author varchar(255) NOT NULL default '',\n        description longtext NOT NULL,\n        timestamp int default NULL,\n        guid varchar(255),\n        PRIMARY KEY (iid),\n        KEY fid (fid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {aggregator_category} (\n        cid serial,\n        title varchar(255) NOT NULL default '',\n        description text NOT NULL,\n        block smallint NOT NULL default '0',\n        PRIMARY KEY (cid),\n        UNIQUE (title)\n      )");
      db_query("CREATE TABLE {aggregator_category_feed} (\n        fid int NOT NULL default '0',\n        cid int NOT NULL default '0',\n        PRIMARY KEY (fid,cid)\n      )");
      db_query("CREATE TABLE {aggregator_category_item} (\n        iid int NOT NULL default '0',\n        cid int NOT NULL default '0',\n        PRIMARY KEY (iid,cid)\n      )");
      db_query("CREATE TABLE {aggregator_feed} (\n        fid serial,\n        title varchar(255) NOT NULL default '',\n        url varchar(255) NOT NULL default '',\n        refresh int NOT NULL default '0',\n        checked int NOT NULL default '0',\n        link varchar(255) NOT NULL default '',\n        description text NOT NULL default '',\n        image text NOT NULL default '',\n        etag varchar(255) NOT NULL default '',\n        modified int NOT NULL default '0',\n        block smallint NOT NULL default '0',\n        PRIMARY KEY (fid),\n        UNIQUE (url),\n        UNIQUE (title)\n      )");
      db_query("CREATE TABLE {aggregator_item} (\n        iid serial,\n        fid int NOT NULL default '0',\n        title varchar(255) NOT NULL default '',\n        link varchar(255) NOT NULL default '',\n        author varchar(255) NOT NULL default '',\n        description text NOT NULL,\n        timestamp int default NULL,\n        guid varchar(255),\n        PRIMARY KEY (iid)\n      )");
      db_query("CREATE INDEX {aggregator_item}_fid_idx ON {aggregator_item} (fid)");
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function aggregator_uninstall() {
  db_query('DROP TABLE {aggregator_category}');
  db_query('DROP TABLE {aggregator_category_feed}');
  db_query('DROP TABLE {aggregator_category_item}');
  db_query('DROP TABLE {aggregator_feed}');
  db_query('DROP TABLE {aggregator_item}');
  variable_del('aggregator_allowed_html_tags');
  variable_del('aggregator_summary_items');
  variable_del('aggregator_clear');
  variable_del('aggregator_category_selector');
}

Functions

Namesort descending Description
aggregator_install Implementation of hook_install().
aggregator_uninstall Implementation of hook_uninstall().