X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=remove_ou_data%2F04_remove_circ.sql;h=30730853e37fbdfb6a3775cb4ac5209ad95cfff9;hp=786de02e9b2b03806836eba9d04775e2c26c6c54;hb=099b914088e5adbba5b47f4f18514ce419b1af6a;hpb=0cefde660c085b23bc9a6120762ae221cec32bbb diff --git a/remove_ou_data/04_remove_circ.sql b/remove_ou_data/04_remove_circ.sql index 786de02..3073085 100644 --- a/remove_ou_data/04_remove_circ.sql +++ b/remove_ou_data/04_remove_circ.sql @@ -44,6 +44,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;