From 6db17fe4e94531abd3253b8300d36ded05b5837d Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 25 Nov 2011 15:46:58 -0500 Subject: [PATCH] LP896405: Address SQL upgrade issues getting to 2.2-alpha1 Martha Driscoll tried out the 2.2-alpha1 upgrade script and found a few problems noted in this thread: http://list.georgialibraries.org/pipermail/open-ils-dev/2011-November/007747.html "upgrade_log" does not exist > LINE 1: INSERT INTO config.upgrade_log (version, applied_to) VALUES . This fails because the "applied_to" column does not exist at this point in the schema upgrade. Just remove the "applied_to" column from the INSERT statement. This will probably fail because most sites won't have applied 0526 to their production server, so move the statements outside of the transaction. Also, in my own testing I ran into: public / evergreen function namespace issues we tried to address back in the 2.0(?) timeframe. New sites will have the is_json() function in the evergreen namespace, while old sites will have it in public, so we do _not_ qualify the function name and just let the searchpath handle the resolution. Signed-off-by: Dan Scott --- Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql index 5d58de5987..d1b5ba34b5 100644 --- a/Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql @@ -1,6 +1,5 @@ --Upgrade Script for 2.1 to 2.2-alpha1 -BEGIN; -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.2-alpha1'); + -- DROP objects that might have existed from a prior run of 0526 -- Yes this is ironic. DROP TABLE IF EXISTS config.db_patch_dependencies; @@ -8,6 +7,8 @@ ALTER TABLE config.upgrade_log DROP COLUMN applied_to; DROP FUNCTION evergreen.upgrade_list_applied_deprecates(TEXT); DROP FUNCTION evergreen.upgrade_list_applied_supersedes(TEXT); +BEGIN; +INSERT INTO config.upgrade_log (version) VALUES ('2.2-alpha1'); INSERT INTO config.upgrade_log (version) VALUES ('0526'); --miker @@ -6121,7 +6122,7 @@ $$ LANGUAGE SQL ROWS 10; -- check whether patch can be applied SELECT evergreen.upgrade_deps_block_check('0641', :eg_version); -ALTER TABLE actor.org_unit_setting ADD CONSTRAINT aous_must_be_json CHECK ( evergreen.is_json(value) ); +ALTER TABLE actor.org_unit_setting ADD CONSTRAINT aous_must_be_json CHECK ( is_json(value) ); -- Evergreen DB patch 0642.data.acq-worksheet-hold-count.sql -- 2.11.0