3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Shell script to update MySQL
9 echo "This script will update a Bacula MySQL database from version 13 to 14"
10 echo " which is needed to convert from Bacula"
14 db_name=${db_name:-@db_name@}
16 mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$
17 DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
18 if [ $DBVERSION != 13 ] ; then
20 echo "The existing database is version $DBVERSION !!"
21 echo "This script can only update an existing version 13 database to version 14."
22 echo "Error. Cannot upgrade this database."
27 if mysql $* -f <<END-OF-DATA
29 ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
30 UPDATE Version SET VersionId=14;
33 echo "Update of Bacula MySQL tables succeeded."
35 echo "Update of Bacula MySQL tables failed."