From 70c8572ea1b421458241b9b3b1cc85cb6bf35057 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 1 Sep 2010 22:19:44 -0700 Subject: 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. --- modules/rest/helpers/rest_installer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/rest/helpers') 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); } -- cgit v1.2.3