X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=remove_ou_data%2F02_remove_patron_extras.sql;h=fc715d6f5cfc1fc23ca6fc0dcaa5e6cf8a25e61e;hp=b993d7b493a087030680d6b339a16d0b6fb94298;hb=dbc902eb8bf45fc6c6287dba5d9242923caaa18d;hpb=9e967d7a4207176f0778f0e296ab39d8223eb431 diff --git a/remove_ou_data/02_remove_patron_extras.sql b/remove_ou_data/02_remove_patron_extras.sql index b993d7b..fc715d6 100644 --- a/remove_ou_data/02_remove_patron_extras.sql +++ b/remove_ou_data/02_remove_patron_extras.sql @@ -63,6 +63,33 @@ WHERE home_ou IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit DELETE FROM actor.usr_message 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 actor.stat_cat_entry_usr_map WHERE target_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 actor.stat_cat_entry_usr_map WHERE stat_cat 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 actor.stat_cat_entry WHERE stat_cat 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 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); + +DELETE FROM permission.usr_perm_map 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 permission.usr_grp_map 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)); + COMMIT; DROP INDEX actor.tmp_addr_replaces;