From: Rogan Hamby Date: Tue, 21 Jul 2020 13:52:33 +0000 (-0400) Subject: order of operations improvement on org removal scripts X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=0c0fb7ed46be05a8e344c141238b63433594fa21 order of operations improvement on org removal scripts --- diff --git a/remove_ou_data/02_remove_patron_extras.sql b/remove_ou_data/02_remove_patron_extras.sql index fc715d6..a9f684d 100644 --- a/remove_ou_data/02_remove_patron_extras.sql +++ b/remove_ou_data/02_remove_patron_extras.sql @@ -55,10 +55,10 @@ DELETE FROM actor.card WHERE usr IN UPDATE actor.usr SET card = NULL WHERE home_ou IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); -DELETE FROM actor.usr_address 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)); UPDATE actor.usr SET mailing_address = NULL, billing_address = NULL WHERE home_ou IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); +DELETE FROM actor.usr_address 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)); DELETE FROM actor.usr_message 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));