function bayesian_install in Spam 5.3
Install bayesian module schema.
File
- filters/
bayesian/ bayesian.install, line 6
Code
function bayesian_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {bayesian_tokens} (\n tid int(10) unsigned NOT NULL auto_increment,\n class varchar(32) NOT NULL default '',\n token varchar(255) NOT NULL default '',\n yes_count int(10) unsigned default '0',\n no_count int(10) unsigned default '0',\n probability int(10) unsigned default '0',\n last int(11) unsigned default '0',\n PRIMARY KEY tid (tid),\n UNIQUE KEY token (class, token),\n KEY yes_count (yes_count),\n KEY no_count (no_count),\n KEY probability (probability),\n KEY last (last)\n ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
case 'pgsql':
db_query("CREATE TABLE {bayesian_tokens} (\n tid SERIAL,\n class VARCHAR(32) NOT NULL DEFAULT '',\n token VARCHAR(255) NOT NULL DEFAULT '',\n yes_count int_unsigned DEFAULT 0,\n no_count int_unsigned DEFAULT 0,\n probability int_unsigned DEFAULT 0,\n last int_unsigned DEFAULT 0,\n PRIMARY KEY (tid),\n CONSTRAINT class_token UNIQUE (class, token)\n )");
db_query("CREATE INDEX {bayesian_tokens}_yes_count_idx ON {bayesian_tokens} (yes_count)");
db_query("CREATE INDEX {bayesian_tokens}_no_count_idx ON {bayesian_tokens} (no_count)");
db_query("CREATE INDEX {bayesian_tokens}_probability_idx ON {bayesian_tokens} (probability)");
db_query("CREATE INDEX {bayesian_tokens}_last_idx ON {bayesian_tokens} (last)");
break;
}
}