From 1cbb6e4d5e5cbc08e8df622992cf37aa99107c25 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Mon, 8 May 2023 19:54:17 -0700 Subject: [PATCH] LP2011434 stamping upgrade script Signed-off-by: Jane Sandberg --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- .../1375.schema.function-selection-ou-fkey.sql | 14 ++++++++++++++ .../xxxx.schema.function-selection-ou-fkey.sql | 14 -------------- 3 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/1375.schema.function-selection-ou-fkey.sql delete mode 100644 Open-ILS/src/sql/Pg/upgrade/xxxx.schema.function-selection-ou-fkey.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index fd0eaba..7c58c94 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1374', :eg_version); -- miker / berick +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1375', :eg_version); -- rhamby / sandbergja CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/1375.schema.function-selection-ou-fkey.sql b/Open-ILS/src/sql/Pg/upgrade/1375.schema.function-selection-ou-fkey.sql new file mode 100644 index 0000000..4bd94da --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/1375.schema.function-selection-ou-fkey.sql @@ -0,0 +1,14 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('1375', :eg_version); + +UPDATE action.hold_request +SET selection_ou = request_lib +WHERE selection_ou NOT IN ( + SELECT id FROM actor.org_unit +); + +ALTER TABLE action.hold_request ADD CONSTRAINT hold_request_selection_ou_fkey FOREIGN KEY (selection_ou) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED NOT VALID; +ALTER TABLE action.hold_request VALIDATE CONSTRAINT hold_request_selection_ou_fkey; + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.function-selection-ou-fkey.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.function-selection-ou-fkey.sql deleted file mode 100644 index e4b6c71..0000000 --- a/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.function-selection-ou-fkey.sql +++ /dev/null @@ -1,14 +0,0 @@ -BEGIN; - -SELECT evergreen.upgrade_deps_block_check('xxxx', :eg_version); - -UPDATE action.hold_request -SET selection_ou = request_lib -WHERE selection_ou NOT IN ( - SELECT id FROM actor.org_unit -); - -ALTER TABLE action.hold_request ADD CONSTRAINT hold_request_selection_ou_fkey FOREIGN KEY (selection_ou) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED NOT VALID; -ALTER TABLE action.hold_request VALIDATE CONSTRAINT hold_request_selection_ou_fkey; - -COMMIT; -- 1.7.2.5