View source
<?php
function ad_notify_install() {
switch ($GLOBALS['db_type']) {
case 'pgsql':
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:
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.'));
}
function ad_notify_uninstall() {
db_query('DROP TABLE {ad_notify}');
}
function ad_notify_update_1() {
$ret = array();
switch ($GLOBALS['db_type']) {
default:
$ret[] = update_sql("ALTER TABLE {ad_notify} ADD aid INT(11) UNSIGNED NOT NULL DEFAULT '0'");
}
return $ret;
}
function ad_notify_update_2() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'pgsql':
break;
default:
$ret[] = update_sql("ALTER TABLE {ad_notify} CONVERT TO CHARACTER SET utf8");
}
return $ret;
}