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=f011c1bf7e0bdcb746105b224f96a2f1673e054d;hb=9279b06588202c95ec978c72ec0ad471f5a5f7c1;hpb=5daa7e37fb3828e5bc77a037afce5c94f755cd4d diff --git a/remove_ou_data/04_remove_circ.sql b/remove_ou_data/04_remove_circ.sql index f011c1b..4780c9d 100644 --- a/remove_ou_data/04_remove_circ.sql +++ b/remove_ou_data/04_remove_circ.sql @@ -24,10 +24,6 @@ ALTER TABLE action.circulation DISABLE TRIGGER age_parent_circ; BEGIN; -UPDATE action.circulation SET parent_circ = NULL WHERE parent_circ -(SELECT id FROM action.circulation WHERE circ_lib = (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)) -AND circ_lib NOT IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); - DELETE FROM action.circulation WHERE usr 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)); @@ -47,8 +43,9 @@ DELETE FROM action.aged_circulation WHERE copy_owning_lib IN 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); -DELETE FROM action.non_cat_in_house_use 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)); +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;