summaryrefslogtreecommitdiff
path: root/modules/tag/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-11-23 18:00:44 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-11-23 18:00:44 +0000
commitab20406ef21c1011c2a4b189e8340dc7ee87a813 (patch)
tree76c41946b86675f42d56e03350605fc49923d61c /modules/tag/helpers
parent7491e3c44affb89fe28030f8759283bc1b4aa291 (diff)
Tag module database definitions
Diffstat (limited to 'modules/tag/helpers')
-rw-r--r--modules/tag/helpers/tag_installer.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php
index 03823ff3..7c10be97 100644
--- a/modules/tag/helpers/tag_installer.php
+++ b/modules/tag/helpers/tag_installer.php
@@ -20,14 +20,31 @@
class tag_installer {
public static function install() {
Kohana::log("debug", "tag_installer::install");
+ $db = Database::instance();
$version = module::get_version("tags");
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,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY(`display_name`))
+ ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+
+ $db->query("CREATE TABLE IF NOT EXISTS `items_tags` (
+ `item_id` int(9) NOT NULL,
+ `tag_id` int(9) NOT NULL,
+ PRIMARY KEY (`item_id`, `tag_id`),
+ UNIQUE KEY(`tag_id`, `item_id`))
+ ENGINE=InnoDB DEFAULT CHARSET=utf8;");
module::set_version("tag", 1);
}
}
public static function uninstall() {
+ $db = Database::instance();
+ $db->query("DROP TABLE IF EXISTS `tags`;");
+ $db->query("DROP TABLE IF EXISTS `items_tags`;");
module::delete("tag");
}
}