summaryrefslogtreecommitdiff
path: root/modules/rest/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-09-01 22:19:44 -0700
committerBharat Mediratta <bharat@menalto.com>2010-09-01 22:19:44 -0700
commit70c8572ea1b421458241b9b3b1cc85cb6bf35057 (patch)
tree821cfa1b1b257ca8623c1777a63531fd4785069d /modules/rest/helpers
parentaf3d5acbcd5df6da8e532a009d5be6ba6d1cca0d (diff)
Make RENAME TABLE operations idempotent so that in case there's a
failure of some kind we can restart the upgrade and it'll continue. Fixes ticket #1325.
Diffstat (limited to 'modules/rest/helpers')
-rw-r--r--modules/rest/helpers/rest_installer.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/rest/helpers/rest_installer.php b/modules/rest/helpers/rest_installer.php
index c2694a29..3c7fea4b 100644
--- a/modules/rest/helpers/rest_installer.php
+++ b/modules/rest/helpers/rest_installer.php
@@ -35,7 +35,9 @@ class rest_installer {
static function upgrade($version) {
$db = Database::instance();
if ($version == 1) {
- $db->query("RENAME TABLE {user_access_tokens} TO {user_access_keys}");
+ if (in_array("user_access_tokens", Database::instance()->list_tables())) {
+ $db->query("RENAME TABLE {user_access_tokens} TO {user_access_keys}");
+ }
module::set_version("rest", $version = 2);
}