From a42d5301d03e7f7c424df4642a31125c09aeafa2 Mon Sep 17 00:00:00 2001 From: Rogan Hamby Date: Thu, 3 Aug 2017 15:23:38 -0400 Subject: [PATCH 1/1] adding deletion of surveys to remove ou scripts --- remove_ou_data/02_remove_patron_extras.sql | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/remove_ou_data/02_remove_patron_extras.sql b/remove_ou_data/02_remove_patron_extras.sql index 9524270..ffbd789 100644 --- a/remove_ou_data/02_remove_patron_extras.sql +++ b/remove_ou_data/02_remove_patron_extras.sql @@ -75,6 +75,15 @@ DELETE FROM actor.stat_cat_entry WHERE stat_cat IN DELETE FROM actor.stat_cat WHERE id IN (SELECT id from actor.stat_cat WHERE owner IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)); +DELETE FROM action.survey_response 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 action.survey_question WHERE survey IN +(SELECT id FROM action.survey WHERE owner IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del)); + +DELETE FROM action.survey WHERE owner IN +(SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); + COMMIT; DROP INDEX actor.tmp_addr_replaces; -- 1.7.2.5