]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/drop_postgresql_tables.in
Backport from Bacula Enterprise
[bacula/bacula] / bacula / src / cats / drop_postgresql_tables.in
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # shell script to delete Bacula tables for PostgreSQL
7
8 bindir=@POSTGRESQL_BINDIR@
9 db_name=@db_name@
10
11 $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
12 drop table unsavedfiles;
13 drop table basefiles;
14 drop table jobmedia;
15 drop table file;
16 drop table job;
17 drop table jobhisto;
18 drop table media;
19 drop table client;
20 drop table pool;
21 drop table fileset;
22 drop table path;
23 drop table filename;
24 drop table counters;
25 drop table version;
26 drop table CDImages;
27 drop table Device;
28 drop table Storage;
29 drop table MediaType;
30 drop table Status;
31 drop table MAC;
32 drop table log;
33 drop table Location;
34 drop table locationlog;
35 drop table PathVisibility;
36 drop table PathHierarchy;
37 drop table RestoreObject;
38 drop table Snapshot;
39 END-OF-DATA
40 pstat=$?
41 if test $pstat = 0; 
42 then
43    echo "Deletion of Bacula PostgreSQL tables succeeded."
44 else
45    echo "Deletion of Bacula PostgreSQL tables failed."
46 fi
47 exit $pstat