From: Rogan Hamby Date: Mon, 17 Oct 2016 12:48:24 +0000 (-0400) Subject: added line to handle child checkouts where parent checkout is at the org being delete... X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=0cefde660c085b23bc9a6120762ae221cec32bbb;hp=c919228a7234c1fdfa9f9cfbae245fc30731eb85 added line to handle child checkouts where parent checkout is at the org being deleted but child is not by nulling parent circ, unfortunately no way to indicate this --- diff --git a/remove_ou_data/04_remove_circ.sql b/remove_ou_data/04_remove_circ.sql index c34da32..786de02 100644 --- a/remove_ou_data/04_remove_circ.sql +++ b/remove_ou_data/04_remove_circ.sql @@ -24,6 +24,10 @@ 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));