add config import/export logic to add new rows for config.rule_*
[migration-tools.git] / sql / nuke-patrons-and-circs.sql
1 -- Copyright 2009-2012, Equinox Software, Inc.
2 --
3 -- This program is free software; you can redistribute it and/or
4 -- modify it under the terms of the GNU General Public License
5 -- as published by the Free Software Foundation; either version 2
6 -- of the License, or (at your option) any later version.
7 --
8 -- This program is distributed in the hope that it will be useful,
9 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
10 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 -- GNU General Public License for more details.
12 --
13 -- You should have received a copy of the GNU General Public License
14 -- along with this program; if not, write to the Free Software
15 -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
16
17 alter table actor.usr disable rule protect_user_delete;
18 begin;
19 delete from actor.usr where usrname !~ 'admin';
20 delete from actor.usr_note where usr not in (select id from actor.usr);
21 delete from actor.usr_address where usr not in (select id from actor.usr);
22 delete from actor.card where usr not in (select id from actor.usr);
23 delete from action.circulation;
24 delete from action.hold_request;
25 delete from money.billing;
26 delete from money.grocery;
27 delete from action.non_cataloged_circulation;
28 delete from action.in_house_use;
29 delete from reporter.template_folder where owner not in (select id from actor.usr);
30 delete from reporter.report_folder where owner not in (select id from actor.usr);
31 delete from reporter.output_folder where owner not in (select id from actor.usr);
32 delete from reporter.template where owner not in (select id from actor.usr);
33 delete from reporter.report where owner not in (select id from actor.usr);
34 delete from reporter.schedule where runner not in (select id from actor.usr);
35 commit;
36 alter table actor.usr enable rule protect_user_delete;