X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=bacula%2Fsrc%2Fcats%2Fdrop_bacula_tables.in;h=f3534167bff11655eb2d092cc1806f576cc054e7;hb=46fff475fa9a502814fe1befa465e84305920eeb;hp=270608c0dda517d72b558938ee65c06f9417ae31;hpb=0a456dac37ac00ff6016b5eeb1761733c66dc4f2;p=bacula%2Fbacula diff --git a/bacula/src/cats/drop_bacula_tables.in b/bacula/src/cats/drop_bacula_tables.in index 270608c0dd..f3534167bf 100755 --- a/bacula/src/cats/drop_bacula_tables.in +++ b/bacula/src/cats/drop_bacula_tables.in @@ -1,19 +1,44 @@ #!/bin/sh # # Drop Bacula tables -- works for whatever is configured, -# MySQL or SQLite +# MySQL, SQLite, Ingres, or PostgreSQL # -if test xsqlite = x@DB_NAME@ ; then - @scriptdir@/drop_sqlite_tables - echo "Dropped SQLite tables" -else - if test xmysql = x@DB_NAME@ ; then - echo "Making MySQL tables" - @scriptdir@/drop_mysql_tables - echo "Dropped MySQL tables" - else - # hardcoded database name - should be a parameter - @scriptdir@/drop_postgresql_tables bacula - echo "Dropped PostgreSQL tables" - fi + +default_db_type=@DEFAULT_DB_TYPE@ + +# +# See if the first argument is a valid backend name. +# If so the user overrides the default database backend. +# +if [ $# -gt 0 ]; then + case $1 in + sqlite3) + db_type=$1 + shift + ;; + mysql) + db_type=$1 + shift + ;; + postgresql) + db_type=$1 + shift + ;; + ingres) + db_type=$1 + shift + ;; + *) + ;; + esac +fi + +# +# If no new db_type is gives use the default db_type. +# +if [ -z "${db_type}" ]; then + db_type="${default_db_type}" fi + +@scriptdir@/drop_${db_type}_tables $* +echo "Dropped ${db_type} tables"