From a164d0ee8049b7b30ae7c6e1963925173871de2c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 23 Nov 2008 20:05:24 +0000 Subject: Fix a few minor bugs in the tags db schema and simplify it a bit. Avoid using restrictions on our data in the database; let's design the system to keep integrity in the app (and make the app robust against minor integrity issues like duplicate tags, etc). --- modules/tag/helpers/tag_installer.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php index 7c10be97..de67bf08 100644 --- a/modules/tag/helpers/tag_installer.php +++ b/modules/tag/helpers/tag_installer.php @@ -21,21 +21,23 @@ class tag_installer { public static function install() { Kohana::log("debug", "tag_installer::install"); $db = Database::instance(); - $version = module::get_version("tags"); + $version = module::get_version("tag"); Kohana::log("debug", "tag: $version"); if ($version == 0) { $db->query("CREATE TABLE IF NOT EXISTS `tags` ( `id` int(9) NOT NULL auto_increment, - `tag_text` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, PRIMARY KEY (`id`), - UNIQUE KEY(`display_name`)) + UNIQUE KEY(`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS `items_tags` ( + `id` int(9) NOT NULL auto_increment, `item_id` int(9) NOT NULL, `tag_id` int(9) NOT NULL, - PRIMARY KEY (`item_id`, `tag_id`), - UNIQUE KEY(`tag_id`, `item_id`)) + PRIMARY KEY (`id`), + KEY(`tag_id`), + KEY(`item_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("tag", 1); } -- cgit v1.2.3