X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=remove_ou_data%2F04_remove_circ.sql;h=4780c9d783bab096718d00398ad0274ff502e601;hp=c34da32ed78d7ce70c631b63f3346791316513a1;hb=7b6f5557a05fa7e4cd09f433398ea4f6368ae519;hpb=c919228a7234c1fdfa9f9cfbae245fc30731eb85 diff --git a/remove_ou_data/04_remove_circ.sql b/remove_ou_data/04_remove_circ.sql index c34da32..4780c9d 100644 --- a/remove_ou_data/04_remove_circ.sql +++ b/remove_ou_data/04_remove_circ.sql @@ -40,6 +40,13 @@ DELETE FROM action.aged_circulation WHERE copy_circ_lib IN DELETE FROM action.aged_circulation WHERE copy_owning_lib IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); +DELETE FROM action.non_cat_in_house_use WHERE org_unit IN +(SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); + +UPDATE action.non_cat_in_house_use SET staff = 1 WHERE staff IN +(SELECT id FROM actor.usr WHERE home_ou IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)) +AND org_unit IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); + COMMIT; ALTER TABLE action.circulation ENABLE TRIGGER action_circulation_aging_tgr;