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=b3f0aed418d34c4d6bf26b59ab1a2f0dea2d5ecf;hp=d37b1135bb774468c2591925139eeff3fd5e3cc5;hb=571263faefabdc094e96ab6bcbb727129791985f;hpb=b7e454b73970bda780caf3830ba844ece0379bee diff --git a/remove_ou_data/06_remove_copies.sql b/remove_ou_data/06_remove_copies.sql index d37b113..b3f0aed 100644 --- a/remove_ou_data/06_remove_copies.sql +++ b/remove_ou_data/06_remove_copies.sql @@ -55,6 +55,10 @@ DELETE FROM vandelay.import_item WHERE imported_as IN ( DELETE FROM asset.copy WHERE circ_lib IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); +DELETE FROM asset.latest_inventory WHERE copy IN + (SELECT li.copy FROM asset.latest_inventory li LEFT JOIN asset.copy acp ON acp.id = li.copy WHERE acp.id IS NULL) +; + COMMIT; DROP INDEX vandelay.tmp_import_as;