Index: filters/duplicate/duplicate.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/spam/filters/duplicate/Attic/duplicate.install,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 duplicate.install --- filters/duplicate/duplicate.install 2 Dec 2007 22:30:12 -0000 1.1.2.3 +++ filters/duplicate/duplicate.install 19 Feb 2008 20:47:45 -0000 @@ -1,35 +1,84 @@ array( + 'iid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'disp-width' => '11' + ), + 'sid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'disp-width' => '11' + ), + 'content_hash' => array( + 'type' => 'char', + 'length' => '32', + 'not null' => TRUE, + 'default' => '' + ), + 'hostname' => array( + 'type' => 'varchar', + 'length' => '15', + 'not null' => TRUE, + 'default' => '' + ), + 'duplicate_hash' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'disp-width' => '11' + ), + 'duplicate_ip' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'disp-width' => '11' + ), + 'spam' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 0, + 'disp-width' => '4' + ), + 'expired' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 0, + 'disp-width' => '4' + ), + 'timestamp' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => FALSE, + 'default' => 0, + 'disp-width' => '11' + ) + ), + 'primary key' => array('iid'), + 'indexes' => array( + 'content_hash' => array('content_hash'), + 'hostname' => array('hostname'), + 'sid' => array('sid'), + 'spam' => array('spam'), + 'timestamp' => array('timestamp') + ), + ); + return $schema; +} + function duplicate_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - // TODO: PostgreSQL support -- patches welcome! - default: - /** - * Tracks a 32-bit hash and the IP for each piece of content. - */ - db_query("CREATE TABLE {spam_duplicate} ( - iid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - sid INT(11) UNSIGNED NOT NULL DEFAULT '0', - content_hash CHAR(32) NOT NULL DEFAULT '', - hostname VARCHAR(15) NOT NULL DEFAULT '', - duplicate_hash INT(11) NOT NULL DEFAULT '0', - duplicate_ip INT(11) NOT NULL DEFAULT '0', - spam TINYINT NOT NULL DEFAULT '0', - expired TINYINT NOT NULL DEFAULT '0', - timestamp INT(11) UNSIGNED DEFAULT '0', - PRIMARY KEY (iid), - KEY (sid), - KEY (content_hash), - KEY (hostname), - KEY (spam), - KEY (timestamp) - ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"); - } + drupal_install_schema('duplicate'); } function duplicate_uninstall() { - db_query('DROP TABLE {spam_duplicate}'); + drupal_uninstall_schema('duplicate'); }