You are here

function spam_update_5302 in Spam 5.3

Introduce spam_statistics table.

File

./spam.install, line 412

Code

function spam_update_5302() {

  // Update contontained in _5300 if updating from 5.x-1.x spam module.
  if (spam_skip_update()) {
    return array();
  }
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    default:
      $ret[] = update_sql("CREATE TABLE {spam_statistics} (\n        stid int(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n        name varchar(64) NOT NULL DEFAULT '',\n        count int(11) UNSIGNED NOT NULL DEFAULT '0',\n        timestamp int(11) UNSIGNED DEFAULT '0',\n        PRIMARY KEY stid (stid),\n        UNIQUE KEY name (name)\n      ) TYPE=MyISAM /* 40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      $ret[] = update_sql("CREATE TABLE {spam_statistics} (\n        stid serial PRIMARY KEY,\n        name varchar(64) NOT NULL DEFAULT '',\n        count integer UNSIGNED NOT NULL DEFAULT '0',\n        timestamp integer UNSIGNED DEFAULT '0',\n\tCONSTRAINT spam_statistics_u UNIQUE(name)\n      );");
      $ret[] = update_sql("CREATE INDEX {spam_statistics}_u_key ON {spam_statistics} (name);");
  }
  return $ret;
}