X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=remove_ou_data%2F16_remove_acq.sql;fp=remove_ou_data%2F16_delete_usrs_stage_3.sql;h=d88d1b7467e953f3e379069384eb2bfea6c5354f;hp=09cc9d2269f2acb2a49eae435f693040fef4167d;hb=fd5875c0d61da5e43f5539e188a451649768d646;hpb=1b5de1513dc4f5b38ff853744d1f10375f3a953a diff --git a/remove_ou_data/16_delete_usrs_stage_3.sql b/remove_ou_data/16_remove_acq.sql similarity index 71% rename from remove_ou_data/16_delete_usrs_stage_3.sql rename to remove_ou_data/16_remove_acq.sql index 09cc9d2..d88d1b7 100644 --- a/remove_ou_data/16_delete_usrs_stage_3.sql +++ b/remove_ou_data/16_remove_acq.sql @@ -19,11 +19,12 @@ \set ECHO all \timing -SELECT id -FROM actor.usr WHERE home_ou IN ( - SELECT (actor.org_unit_descendants(id)).id FROM actor.org_unit - WHERE shortname IN (SELECT shortname FROM esi.ous_to_del) +BEGIN; + +DELETE FROM acq.lineitem WHERE picklist IN (SELECT id FROM acq.picklist WHERE org_unit IN + (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del) ); +DELETE FROM acq.picklist WHERE org_unit IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); --- find the problems and clear them up +COMMIT;