Utilities to nuke data
[migration-tools.git] / sql / nuke-patrons-and-circs.sql
1 alter table actor.usr disable rule protect_user_delete;
2 begin;
3 delete from actor.usr where usrname !~ 'admin';
4 delete from actor.usr_note where usr not in (select id from actor.usr);
5 delete from actor.usr_address where usr not in (select id from actor.usr);
6 delete from actor.card where usr not in (select id from actor.usr);
7 delete from action.circulation;
8 delete from action.hold_request;
9 delete from money.billing;
10 delete from money.grocery;
11 delete from action.non_cataloged_circulation;
12 delete from action.in_house_use;
13 delete from reporter.template_folder where owner not in (select id from actor.usr);
14 delete from reporter.report_folder where owner not in (select id from actor.usr);
15 delete from reporter.output_folder where owner not in (select id from actor.usr);
16 delete from reporter.template where owner not in (select id from actor.usr);
17 delete from reporter.report where owner not in (select id from actor.usr);
18 delete from reporter.schedule where runner not in (select id from actor.usr);
19 commit;
20 alter table actor.usr enable rule protect_user_delete;