<?php
// $Id: forum.install,v 1.6.2.1 2008/07/06 00:07:13 drumm Exp $

/**
 * Implementation of hook_install().
 */
function forum_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {forum} (
        nid int unsigned NOT NULL default '0',
        vid int unsigned NOT NULL default '0',
        tid int unsigned NOT NULL default '0',
        PRIMARY KEY (vid),
        KEY nid (nid),
        KEY tid (tid)
      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {forum} (
        nid int_unsigned NOT NULL default '0',
        vid int_unsigned NOT NULL default '0',
        tid int_unsigned NOT NULL default '0',
        PRIMARY KEY (vid)
      )");
      db_query("CREATE INDEX {forum}_nid_idx ON {forum} (nid)");
      db_query("CREATE INDEX {forum}_tid_idx ON {forum} (tid)");
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function forum_uninstall() {
  db_query('DROP TABLE {forum}');
  variable_del('forum_containers');
  variable_del('forum_nav_vocabulary');
  variable_del('forum_hot_topic');
  variable_del('forum_per_page');
  variable_del('forum_order');
  variable_del('forum_block_num_0');
  variable_del('forum_block_num_1');
}
