X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fcats%2Fupdate_postgresql_tables.in;h=b6e395e727e14371d862eb540e8825154af09600;hb=ac96a9d9bc8a5a23cdd7a1b1bff3e6e2ac863cb9;hp=5be47510e7b7356c3b2d5621342cd8e1a206e8a4;hpb=f4bd71881db8f792e079fe416d6f3e9cb3eb5f14;p=bacula%2Fbacula diff --git a/bacula/src/cats/update_postgresql_tables.in b/bacula/src/cats/update_postgresql_tables.in old mode 100755 new mode 100644 index 5be47510e7..b6e395e727 --- a/bacula/src/cats/update_postgresql_tables.in +++ b/bacula/src/cats/update_postgresql_tables.in @@ -1,29 +1,88 @@ #!/bin/sh # -# Shell script to update PostgreSQL tables from version 1.34 to 1.35.5 +# Shell script to update MySQL tables from Bacula Community version 3.0.x to 5.0.0 # echo " " -echo "This script will update a Bacula PostgreSQL database from version 7 to 8" -echo "Depending on the size of your database," -echo "this script may take several minutes to run." +echo "This script will update a Bacula MySQL database from version 11 to 12" +echo " which is needed to convert from Bacula Community version 3.0.x to 5.0.x" echo " " + bindir=@SQL_BINDIR@ +PATH="$bindir:$PATH" +db_name=@db_name@ + +DBVERSION=`psql ${db_name} -t --pset format=unaligned -c "select VersionId from Version"` +if [ $DBVERSION != 11 ] ; then + echo " " + echo "The existing database is version $DBVERSION !!" + echo "This script can only update an existing version 11 database to version 12." + echo "Error. Cannot upgrade this database." + echo " " + exit 1 +fi + +if psql -f - -d ${db_name} $* <