X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=remove_ou_data%2F10_clear_vandelay_reports.sql;fp=remove_ou_data%2F10_clear_vandelay_reports.sql;h=652d0a9be67e2f3f932d88f69aca2e3233faa260;hp=2a44d2edf7279cab02f71263db0ffa200b3fdc5a;hb=b7e454b73970bda780caf3830ba844ece0379bee;hpb=0c0fb7ed46be05a8e344c141238b63433594fa21 diff --git a/remove_ou_data/10_clear_vandelay_reports.sql b/remove_ou_data/10_clear_vandelay_reports.sql index 2a44d2e..652d0a9 100644 --- a/remove_ou_data/10_clear_vandelay_reports.sql +++ b/remove_ou_data/10_clear_vandelay_reports.sql @@ -27,12 +27,17 @@ BEGIN; DELETE FROM vandelay.queue 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 reporter.report_folder WHERE owner IN +DELETE FROM reporter.report 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 reporter.report WHERE owner IN +DELETE FROM reporter.report_folder 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 reporter.report WHERE template IN + (SELECT id FROM reporter.template 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)) + ) AND id NOT IN (SELECT report FROM reporter.schedule WHERE complete_time IS NULL); + DELETE FROM reporter.output_folder 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));