summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-08-24 09:23:25 -0700
committerShawn O. Pearce <sop@google.com>2009-08-24 09:23:25 -0700
commitfff34ddfb83ec274fba9ac1dcf88816e89701a84 (patch)
treeabaf57bca8131e9c8a32018950df8e5bd0818220
parentf2ac67d9d99102aab4d5ec1094cc2051f442e9e7 (diff)
Don't drop max_session_age column in transaction during upgrade
It depends on what version of schema we are upgrading from as to whether or not this column exists in the system_config table. If the database is relatively new and was created from a schema which does not define this column, it won't have it, and the upgrade would abort with an error. Therefore we need to process this outside of the transaction block, allowing it to fail and continue. Change-Id: I7e625a2d5269eb76e64901c2302a661135bd9021 Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--src/main/webapp/WEB-INF/sql/upgrade016_017_mysql.sql3
-rw-r--r--src/main/webapp/WEB-INF/sql/upgrade016_017_postgres.sql3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/main/webapp/WEB-INF/sql/upgrade016_017_mysql.sql b/src/main/webapp/WEB-INF/sql/upgrade016_017_mysql.sql
index bb4454ea03..43b2a92dca 100644
--- a/src/main/webapp/WEB-INF/sql/upgrade016_017_mysql.sql
+++ b/src/main/webapp/WEB-INF/sql/upgrade016_017_mysql.sql
@@ -1,8 +1,9 @@
-- Upgrade: schema_version 16 to 17 (MySQL)
--
-ALTER TABLE system_config DROP xsrf_private_key;
ALTER TABLE system_config DROP max_session_age;
+
+ALTER TABLE system_config DROP xsrf_private_key;
ALTER TABLE system_config CHANGE COLUMN account_private_key register_email_private_key VARCHAR(36) NOT NULL;
ALTER TABLE changes ADD change_key VARCHAR(60);
diff --git a/src/main/webapp/WEB-INF/sql/upgrade016_017_postgres.sql b/src/main/webapp/WEB-INF/sql/upgrade016_017_postgres.sql
index b3d5f70f2b..66f5a7ec85 100644
--- a/src/main/webapp/WEB-INF/sql/upgrade016_017_postgres.sql
+++ b/src/main/webapp/WEB-INF/sql/upgrade016_017_postgres.sql
@@ -21,12 +21,13 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
+ALTER TABLE system_config DROP max_session_age;
+
BEGIN;
SELECT check_schema_version(16);
ALTER TABLE system_config DROP xsrf_private_key;
-ALTER TABLE system_config DROP max_session_age;
ALTER TABLE system_config RENAME account_private_key TO register_email_private_key;
ALTER TABLE changes ADD change_key VARCHAR(60);