From: Rogan Hamby Date: Wed, 22 Jul 2020 19:01:06 +0000 (-0400) Subject: adding acq stuff into patron extras file X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=6428c632f2d657ecf0dd08c8ba07920d87f451e7 adding acq stuff into patron extras file --- diff --git a/remove_ou_data/13_remove_more_patron_extras.sql b/remove_ou_data/13_remove_more_patron_extras.sql index b3a64de..1d5ee31 100644 --- a/remove_ou_data/13_remove_more_patron_extras.sql +++ b/remove_ou_data/13_remove_more_patron_extras.sql @@ -28,4 +28,40 @@ DELETE FROM action.non_cataloged_circulation WHERE staff IN DELETE FROM action.usr_circ_history 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 acq.user_request 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 acq.lineitem WHERE creator 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 acq.lineitem WHERE selector 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 acq.lineitem WHERE editor 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 acq.lineitem WHERE purchase_order IN +(SELECT id FROM acq.purchase_order WHERE creator 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 acq.po_note WHERE purchase_order IN +(SELECT id FROM acq.purchase_order WHERE creator 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 acq.purchase_order WHERE creator 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 acq.purchase_order WHERE owner 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 acq.fund_allocation WHERE fund IN +(SELECT id FROM acq.fund WHERE org IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)); +DELETE FROM acq.invoice_item WHERE fund_debit IN +(SELECT id FROM acq.fund_debit WHERE fund IN (SELECT id FROM acq.fund WHERE org IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del))); +DELETE FROM acq.invoice WHERE receiver 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 acq.lineitem_detail WHERE fund IN +(SELECT id FROM acq.fund WHERE org IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)); +DELETE FROM acq.fund_debit WHERE fund IN +(SELECT id FROM acq.fund WHERE org IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)); +DELETE FROM acq.fund_transfer WHERE src_fund IN +(SELECT id FROM acq.fund WHERE org IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)); +DELETE FROM acq.fund_transfer WHERE dest_fund IN +(SELECT id FROM acq.fund WHERE org IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)); +DELETE FROM acq.fund WHERE org IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); + + COMMIT;