From: Michal Rakowski Date: Mon, 12 Apr 2021 15:11:33 +0000 (+0200) Subject: catalog: update to ver 1024 X-Git-Tag: Release-11.3.2~575 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1020b2afa133668c0c62dee21f7caf497db85198;p=thirdparty%2Fbacula.git catalog: update to ver 1024 --- diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 53167597c..26e78748d 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -3878,9 +3878,11 @@ AC_CONFIG_FILES([ updatedb/update_postgresql_tables_11_to_12 \ updatedb/update_postgresql_tables_1021_to_1022 \ updatedb/update_postgresql_tables_1022_to_1023 \ + updatedb/update_postgresql_tables_1023_to_1024 \ updatedb/update_mysql_tables_1020_to_1021 \ updatedb/update_mysql_tables_1021_to_1022 \ updatedb/update_mysql_tables_1022_to_1023 \ + updatedb/update_mysql_tables_1023_to_1024 \ examples/nagios/check_bacula/Makefile \ platforms/rpms/redhat/bacula.spec \ platforms/rpms/redhat/bacula-bat.spec \ diff --git a/bacula/platforms/rpms/redhat/bacula.spec.in b/bacula/platforms/rpms/redhat/bacula.spec.in index 17fdfa586..a2884f8a8 100644 --- a/bacula/platforms/rpms/redhat/bacula.spec.in +++ b/bacula/platforms/rpms/redhat/bacula.spec.in @@ -1135,7 +1135,7 @@ if mysql 2>/dev/null bacula -e 'select * from Version;' ; then echo "Creating bacula tables..." %{script_dir}/make_mysql_tables - elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then + elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1024" ]; then echo "This release requires an upgrade to your bacula database." echo "Backing up your current database..." mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2 @@ -1189,7 +1189,7 @@ if echo 'select * from Version;' | su - postgres -c 'psql bacula' 2>/dev/null; t echo "Granting privileges for PostgreSQL user bacula..." su - postgres -c %{script_dir}/grant_postgresql_privileges - elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then + elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1024" ]; then echo "This release requires an upgrade to your bacula database." echo "Backing up your current database..." su - postgres -c 'pg_dump bacula' | bzip2 > %{working_dir}/bacula_backup.sql.bz2 diff --git a/bacula/platforms/rpms/suse/bacula.spec.in b/bacula/platforms/rpms/suse/bacula.spec.in index 5d00dbd61..8f654451f 100644 --- a/bacula/platforms/rpms/suse/bacula.spec.in +++ b/bacula/platforms/rpms/suse/bacula.spec.in @@ -1152,7 +1152,7 @@ if mysql 2>/dev/null bacula -e 'select * from Version;' ; then echo "Creating bacula tables..." %{script_dir}/make_mysql_tables - elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then + elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1024" ]; then echo "This release requires an upgrade to your bacula database." echo "Backing up your current database..." mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2 @@ -1206,7 +1206,7 @@ if echo 'select * from Version;' | su - postgres -c 'psql bacula' 2>/dev/null; t echo "Granting privileges for PostgreSQL user bacula..." su - postgres -c %{script_dir}/grant_postgresql_privileges - elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1015" ]; then + elif [ "$DB_VER" -ge "12" -a "$DB_VER" -lt "1024" ]; then echo "This release requires an upgrade to your bacula database." echo "Backing up your current database..." su - postgres -c 'pg_dump bacula' | bzip2 > %{working_dir}/bacula_backup.sql.bz2 diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 6ccd46840..e9998c73d 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 1023 +#define BDB_VERSION 1024 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 28c87fb2f..96c877ff1 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -552,7 +552,7 @@ CREATE TABLE Version ( ); -- Initialize Version -INSERT INTO Version (VersionId) VALUES (1023); +INSERT INTO Version (VersionId) VALUES (1024); END-OF-DATA then diff --git a/bacula/src/cats/make_postgresql_tables.in b/bacula/src/cats/make_postgresql_tables.in index f4b1c2b2b..9c495ad54 100644 --- a/bacula/src/cats/make_postgresql_tables.in +++ b/bacula/src/cats/make_postgresql_tables.in @@ -68,6 +68,7 @@ create index object_category_idx on Object (ObjectCategory); create index object_type_idx on Object (ObjectType); create index object_name_idx on Object (ObjectName); create index object_source_idx on Object (ObjectSource); +create index object_status_idx on Object (ObjectStatus); CREATE TABLE Events ( @@ -553,7 +554,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 (1023); +INSERT INTO Version (VersionId) VALUES (1024); -- 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 96dec7787..7e4c79fd5 100644 --- a/bacula/src/cats/make_sqlite3_tables.in +++ b/bacula/src/cats/make_sqlite3_tables.in @@ -546,7 +546,7 @@ INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES ('I', 'Incomplete Job',25); -- Initialize Version -INSERT INTO Version (VersionId) VALUES (1023); +INSERT INTO Version (VersionId) VALUES (1024); PRAGMA default_cache_size = 100000; PRAGMA synchronous = NORMAL; diff --git a/bacula/src/cats/update_mysql_tables.in b/bacula/src/cats/update_mysql_tables.in index be73b3e6a..3f980286d 100644 --- a/bacula/src/cats/update_mysql_tables.in +++ b/bacula/src/cats/update_mysql_tables.in @@ -523,4 +523,21 @@ END-OF-DATA fi fi +if [ "$DBVERSION" -eq 1023 ] ; then + if mysql $* -f </tmp/$$ +DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$` +if [ $DBVERSION != 1023 ] ; then + echo " " + echo "The existing database is version $DBVERSION !!" + echo "This script can only update an existing version 1023 database to version 1024." + echo "Error. Cannot upgrade this database." + echo " " + exit 1 +fi + +if mysql $* -f <