diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-23 20:05:24 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-23 20:05:24 +0000 |
commit | a164d0ee8049b7b30ae7c6e1963925173871de2c (patch) | |
tree | c94e1ef299bf36affc0edf4f908e37c541362933 | |
parent | a43b8d03a176faf0092da60b019f38d65c5e90ea (diff) |
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).
-rw-r--r-- | modules/tag/helpers/tag_installer.php | 12 |
1 files changed, 7 insertions, 5 deletions
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); } |