From: Eric Bollengier Date: Fri, 15 Oct 2021 13:47:04 +0000 (+0200) Subject: Update SQL scripts for version 1025 X-Git-Tag: Beta-15.0.0~819 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=781f2f41a6f041e9b9bd49e241f706daa124d78d;p=thirdparty%2Fbacula.git Update SQL scripts for version 1025 --- diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 419d979c8..2881e226a 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -48,7 +48,7 @@ */ /* Current database version number for all drivers */ -#define BDB_VERSION 1024 +#define BDB_VERSION 1025 typedef void (DB_LIST_HANDLER)(void *, const char *); typedef int (DB_RESULT_HANDLER)(void *, int, char **); diff --git a/bacula/src/cats/make_mysql_tables.in b/bacula/src/cats/make_mysql_tables.in index 9dec640a1..6c2ae14d5 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -607,7 +607,7 @@ CREATE TABLE Version ( ); -- Initialize Version -INSERT INTO Version (VersionId) VALUES (1024); +INSERT INTO Version (VersionId) VALUES (1025); END-OF-DATA then diff --git a/bacula/src/cats/make_postgresql_tables.in b/bacula/src/cats/make_postgresql_tables.in index 6d89aa904..4481a5343 100644 --- a/bacula/src/cats/make_postgresql_tables.in +++ b/bacula/src/cats/make_postgresql_tables.in @@ -628,7 +628,7 @@ CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device text_pattern_ops, Volume text_pattern_ops, Name text_pattern_ops); -INSERT INTO Version (VersionId) VALUES (1024); +INSERT INTO Version (VersionId) VALUES (1025); -- Make sure we have appropriate permissions diff --git a/bacula/src/cats/make_sqlite3_tables.in b/bacula/src/cats/make_sqlite3_tables.in index bb8b12d99..9bc560f1f 100644 --- a/bacula/src/cats/make_sqlite3_tables.in +++ b/bacula/src/cats/make_sqlite3_tables.in @@ -12,6 +12,64 @@ cd @working_dir@ db_name=@db_name@ sqlite3 $* ${db_name}.db </tmp/$$ +DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$` +if [ $DBVERSION != 1024 ] ; then + echo " " + echo "The existing database is version $DBVERSION !!" + echo "This script can only update an existing version 1024 database to version 1025." + echo "Error. Cannot upgrade this database." + echo " " + exit 1 +fi + +if mysql $* -f <