From 00dd2bff780ec67b4a021f4ba8ae8291efe29dff Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 29 Oct 2011 16:45:47 +0200 Subject: [PATCH] Add new updatedb files --- .../updatedb/update_mysql_tables_12_to_14.in | 56 +++++++++++++++++++ .../update_postgresql_tables_12_to_14.in | 56 +++++++++++++++++++ .../update_sqlite3_tables_12_to_14.in | 52 +++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 bacula/updatedb/update_mysql_tables_12_to_14.in create mode 100644 bacula/updatedb/update_postgresql_tables_12_to_14.in create mode 100644 bacula/updatedb/update_sqlite3_tables_12_to_14.in diff --git a/bacula/updatedb/update_mysql_tables_12_to_14.in b/bacula/updatedb/update_mysql_tables_12_to_14.in new file mode 100644 index 0000000000..f8a7ec3873 --- /dev/null +++ b/bacula/updatedb/update_mysql_tables_12_to_14.in @@ -0,0 +1,56 @@ +#!/bin/sh +# +# Shell script to update MySQL Community version 5.0.x to 5.2.x +# +echo " " +echo "This script will update a Bacula MySQL database from version 12 to 14" +echo " which is needed to convert from Bacula Community version 5.0.x to 5.2.x" +echo " " +bindir=@MYSQL_BINDIR@ +PATH="$bindir:$PATH" +db_name=@db_name@ + +mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$ +DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$` +if [ $DBVERSION != 12 ] ; then + echo " " + echo "The existing database is version $DBVERSION !!" + echo "This script can only update an existing version 12 database to version 14." + echo "Error. Cannot upgrade this database." + echo " " + exit 1 +fi + +if mysql $* -f <