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

bindir=@MYSQL_BINDIR@
db_name=@db_name@

if $bindir/mysql $* <<END-OF-DATA
USE ${db_name};
DROP TABLE IF EXISTS Filename;
DROP TABLE IF EXISTS Path;
DROP TABLE IF EXISTS LongName;
DROP TABLE IF EXISTS Device;
DROP TABLE IF EXISTS Storage;
DROP TABLE IF EXISTS MediaType;
DROP TABLE IF EXISTS File;
DROP TABLE IF EXISTS Client;
DROP TABLE IF EXISTS Job;
DROP TABLE IF EXISTS JobHisto;
DROP TABLE IF EXISTS Media;
DROP TABLE IF EXISTS JobMedia;
DROP TABLE IF EXISTS Pool;
DROP TABLE IF EXISTS MultiVolume;
DROP TABLE IF EXISTS FileSave;	 
DROP TABLE IF EXISTS FileSet;	
DROP TABLE IF EXISTS Version;
DROP TABLE IF EXISTS Counters;
DROP TABLE IF EXISTS BaseFiles;
DROP TABLE IF EXISTS UnsavedFiles;
DROP TABLE IF EXISTS CDImages;
DROP TABLE IF EXISTS Status;
DROP TABLE IF EXISTS MAC;
DROP TABLE IF EXISTS Log;
DROP TABLE IF EXISTS Location;
DROP TABLE IF EXISTS LocationLog;
DROP TABLE IF EXISTS PathVisibility;
DROP TABLE IF EXISTS PathHierarchy;
DROP TABLE IF EXISTS RestoreObject;
END-OF-DATA
then
   echo "Deletion of ${db_name} MySQL tables succeeded."
else
   echo "Deletion of ${db_name} MySQL tables failed."
fi
exit 0
