]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/1049.data.nullify_invalid_act.age_protect_act.circ_as_type.sql
LP#1806968 Teach Vandelay to pass correct auth tracker type
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 1049.data.nullify_invalid_act.age_protect_act.circ_as_type.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('1049', :eg_version); -- mmorgan/stompro/gmcharlt
4
5 \echo -----------------------------------------------------------
6 \echo Setting invalid age_protect and circ_as_type entries to NULL,
7 \echo otherwise they will break the Serial Copy Templates editor.
8 \echo Please review any Serial Copy Templates listed below.
9 \echo
10 UPDATE asset.copy_template act
11 SET age_protect = NULL
12 FROM actor.org_unit aou
13 WHERE aou.id=act.owning_lib
14    AND act.age_protect NOT IN
15    (
16    SELECT id FROM config.rule_age_hold_protect
17    )
18 RETURNING act.id "Template ID", act.name "Template Name",
19           aou.shortname "Owning Lib",
20           'Age Protection value reset to null.' "Description";
21
22 UPDATE asset.copy_template act
23 SET circ_as_type = NULL
24 FROM actor.org_unit aou
25 WHERE aou.id=act.owning_lib
26    AND act.circ_as_type NOT IN
27    (
28    SELECT code FROM config.item_type_map
29    )
30 RETURNING act.id "Template ID", act.name "Template Name",
31           aou.shortname "Owning Lib",
32           'Circ as Type value reset to null.' as "Description";
33
34 \echo -----------End Serial Template Fix----------------
35 COMMIT;