From: Rogan Hamby Date: Wed, 15 Mar 2023 12:07:38 +0000 (-0400) Subject: adding a check in the upgrade script for a non-existent selection_ou and changing... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Frogan%2Flp2011434_selction_ou_fkey;p=working%2FEvergreen.git adding a check in the upgrade script for a non-existent selection_ou and changing it to the request_lib --- 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 index 728ed356ec..2c8d2ee35d 100644 --- 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 @@ -2,6 +2,14 @@ BEGIN; SELECT evergreen.upgrade_deps_block_check('xxxx', :eg_version); +UPDATE action.hold_request +SET selection_ou = request_lib +WHERE id IN ( + SELECT ahr.id FROM action.hold_request ahr + LEFT JOIN actor.org_unit aou ON aou.id = ahr.selection_ou + WHERE aou.id IS NULL +); + ALTER TABLE action.hold_request ADD CONSTRAINT hold_request_selection_ou_fkey FOREIGN KEY (selection_ou) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED; COMMIT;