#!/bin/sh
#
# shell script to delete Bacula tables for PostgreSQL

bindir=@POSTGRESQL_BINDIR@
db_name=@db_name@

$bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
drop table unsavedfiles;
drop table basefiles;
drop table jobmedia;
drop table file;
drop table job;
drop table jobhisto;
drop table media;
drop table client;
drop table pool;
drop table fileset;
drop table path;
drop table filename;
drop table counters;
drop table version;
drop table CDImages;
drop table Device;
drop table Storage;
drop table MediaType;
drop table Status;
drop table MAC;
drop table log;
drop table Location;
drop table locationlog;
drop table PathVisibility;
drop table PathHierarchy;
drop table RestoreObject;
END-OF-DATA
pstat=$?
if test $pstat = 0; 
then
   echo "Deletion of Bacula PostgreSQL tables succeeded."
else
   echo "Deletion of Bacula PostgreSQL tables failed."
fi
exit $pstat
