LP#1075401: stamp DB update
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 7 Aug 2017 20:44:32 +0000 (16:44 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 7 Aug 2017 20:44:32 +0000 (16:44 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/1049.data.nullify_invalid_act.age_protect_act.circ_as_type.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.data.nullify_invalid_act.age_protect_act.circ_as_type.sql [deleted file]

index a928378..6cc41db 100644 (file)
@@ -90,7 +90,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 ('1048', :eg_version); -- phasefx/berick
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1049', :eg_version); -- mmorgan/stompro/gmcharlt
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/1049.data.nullify_invalid_act.age_protect_act.circ_as_type.sql b/Open-ILS/src/sql/Pg/upgrade/1049.data.nullify_invalid_act.age_protect_act.circ_as_type.sql
new file mode 100644 (file)
index 0000000..5177b6d
--- /dev/null
@@ -0,0 +1,35 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1049', :eg_version); -- mmorgan/stompro/gmcharlt
+
+\echo -----------------------------------------------------------
+\echo Setting invalid age_protect and circ_as_type entries to NULL,
+\echo otherwise they will break the Serial Copy Templates editor.
+\echo Please review any Serial Copy Templates listed below.
+\echo
+UPDATE asset.copy_template act
+SET age_protect = NULL
+FROM actor.org_unit aou
+WHERE aou.id=act.owning_lib
+   AND act.age_protect NOT IN
+   (
+   SELECT id FROM config.rule_age_hold_protect
+   )
+RETURNING act.id "Template ID", act.name "Template Name",
+          aou.shortname "Owning Lib",
+          'Age Protection value reset to null.' "Description";
+
+UPDATE asset.copy_template act
+SET circ_as_type = NULL
+FROM actor.org_unit aou
+WHERE aou.id=act.owning_lib
+   AND act.circ_as_type NOT IN
+   (
+   SELECT code FROM config.item_type_map
+   )
+RETURNING act.id "Template ID", act.name "Template Name",
+          aou.shortname "Owning Lib",
+          'Circ as Type value reset to null.' as "Description";
+
+\echo -----------End Serial Template Fix----------------
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.nullify_invalid_act.age_protect_act.circ_as_type.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.nullify_invalid_act.age_protect_act.circ_as_type.sql
deleted file mode 100644 (file)
index 7eafe11..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-BEGIN;
-
--- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-\echo -----------------------------------------------------------
-\echo Setting invalid age_protect and circ_as_type entries to NULL,
-\echo otherwise they will break the Serial Copy Templates editor.
-\echo Please review any Serial Copy Templates listed below.
-\echo
-UPDATE asset.copy_template act
-SET age_protect = NULL
-FROM actor.org_unit aou
-WHERE aou.id=act.owning_lib
-   AND act.age_protect NOT IN
-   (
-   SELECT id FROM config.rule_age_hold_protect
-   )
-RETURNING act.id "Template ID", act.name "Template Name",
-          aou.shortname "Owning Lib",
-          'Age Protection value reset to null.' "Description";
-
-UPDATE asset.copy_template act
-SET circ_as_type = NULL
-FROM actor.org_unit aou
-WHERE aou.id=act.owning_lib
-   AND act.circ_as_type NOT IN
-   (
-   SELECT code FROM config.item_type_map
-   )
-RETURNING act.id "Template ID", act.name "Template Name",
-          aou.shortname "Owning Lib",
-          'Circ as Type value reset to null.' as "Description";
-
-\echo -----------End Serial Template Fix----------------
-COMMIT;