summaryrefslogtreecommitdiff
path: root/modules/rest/helpers/rest_installer.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-03-31 07:14:06 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-03-31 07:14:06 -0700
commitf2ed1eeab2074fc004c604d02bbf2ebe7c1177db (patch)
treefe0f4037e44cd33d5716d1a44930ed19ca3a34fc /modules/rest/helpers/rest_installer.php
parente56473c5d78842210b7825300bd9b373c104cb83 (diff)
parentca977dce516b9e2ca9539db69fce188ed33d971c (diff)
Merge branch 'master' into talmdal_dev
Conflicts: modules/rest/controllers/rest.php
Diffstat (limited to 'modules/rest/helpers/rest_installer.php')
-rw-r--r--modules/rest/helpers/rest_installer.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/rest/helpers/rest_installer.php b/modules/rest/helpers/rest_installer.php
index f69f62d1..aeb9573e 100644
--- a/modules/rest/helpers/rest_installer.php
+++ b/modules/rest/helpers/rest_installer.php
@@ -20,7 +20,7 @@
class rest_installer {
static function install() {
Database::instance()
- ->query("CREATE TABLE {user_access_tokens} (
+ ->query("CREATE TABLE {user_access_keys} (
`id` int(9) NOT NULL auto_increment,
`user_id` int(9) NOT NULL,
`access_key` char(32) NOT NULL,
@@ -28,10 +28,18 @@ class rest_installer {
UNIQUE KEY(`access_key`),
UNIQUE KEY(`user_id`))
DEFAULT CHARSET=utf8;");
- module::set_version("rest", 1);
+ module::set_version("rest", 2);
+ }
+
+ static function upgrade($version) {
+ $db = Database::instance();
+ if ($version == 1) {
+ $db->query("RENAME TABLE {user_access_tokens} TO {user_access_keys}");
+ module::set_version("rest", $version = 2);
+ }
}
static function uninstall() {
- Database::instance()->query("DROP TABLE IF EXISTS {user_access_tokens}");
+ Database::instance()->query("DROP TABLE IF EXISTS {user_access_keys}");
}
}