X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=remove_ou_data%2F06_remove_copies.sql;fp=remove_ou_data%2F06_remove_copies.sql;h=58cbcb0b47efb641611db495c8cb87865e0705e3;hp=b3f0aed418d34c4d6bf26b59ab1a2f0dea2d5ecf;hb=5eccd3f13f18cf1049cd1ea24a2df36061306158;hpb=9371180a7f4ff887eb3b78076745c200b212ad0a diff --git a/remove_ou_data/06_remove_copies.sql b/remove_ou_data/06_remove_copies.sql index b3f0aed..58cbcb0 100644 --- a/remove_ou_data/06_remove_copies.sql +++ b/remove_ou_data/06_remove_copies.sql @@ -25,6 +25,12 @@ CREATE INDEX tmp_import_as ON vandelay.import_item(imported_as); BEGIN; +DELETE FROM asset.copy_alert WHERE copy IN ( + SELECT id FROM asset.copy WHERE circ_lib IN + (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del) +); + + -- NOTE: no FK DELETE FROM asset.opac_visible_copies WHERE copy_id IN ( SELECT id FROM asset.copy WHERE circ_lib IN