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

bindir=@SQL_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 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;
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


syntax highlighted by Code2HTML, v. 0.9.1