<?php
// $Id: notify.install,v 1.2.2.2 2006/04/20 18:57:21 robroy Exp $

/**
 * Implementation of hook_install()
 */
function notify_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $created = db_query("CREATE TABLE IF NOT EXISTS {notify} (
	      uid INT(10) UNSIGNED NOT NULL DEFAULT '0',
	      status TINYINT(2) NOT NULL DEFAULT '0',
	      node TINYINT(2) NOT NULL DEFAULT '0',
	      comment TINYINT(2) NOT NULL DEFAULT '0',
	      attempts TINYINT(4) NOT NULL DEFAULT '0',
	      teasers TINYINT(4) NOT NULL DEFAULT '0',
	      PRIMARY KEY (uid)
	    ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
      
    case 'pgsql':
      $created = db_query("CREATE TABLE {notify} (
        uid integer NOT NULL DEFAULT '0',
		status integer NOT NULL DEFAULT '0',
		node integer NOT NULL DEFAULT '0',
		comment integer NOT NULL DEFAULT '0',
		attempts integer NOT NULL DEFAULT '0',
		teasers integer NOT NULL DEFAULT '0',
		PRIMARY KEY (uid));");
      break;
  }

  if ($created) {
    drupal_set_message(t('Notify module installed successfully.'));
  }
  else {
    drupal_set_message(t('Table installation for the Notify module was unsuccessful. The tables may need to be installed by hand.'), 'error');
  }
}
