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