From 0c0fb7ed46be05a8e344c141238b63433594fa21 Mon Sep 17 00:00:00 2001 From: Rogan Hamby Date: Tue, 21 Jul 2020 09:52:33 -0400 Subject: [PATCH] order of operations improvement on org removal scripts --- remove_ou_data/02_remove_patron_extras.sql | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) 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)); -- 1.7.2.5