LP2011434 stamping upgrade script
authorJane Sandberg <js7389@princeton.edu>
Tue, 9 May 2023 02:54:17 +0000 (19:54 -0700)
committerJane Sandberg <js7389@princeton.edu>
Tue, 9 May 2023 02:54:17 +0000 (19:54 -0700)
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/1375.schema.function-selection-ou-fkey.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/xxxx.schema.function-selection-ou-fkey.sql [deleted file]

index fd0eaba..7c58c94 100644 (file)
@@ -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 (file)
index 0000000..4bd94da
--- /dev/null
@@ -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 (file)
index e4b6c71..0000000
+++ /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;