From: Michal Rakowski Date: Thu, 15 Oct 2020 20:53:18 +0000 (+0200) Subject: Update catalog to version 1023 X-Git-Tag: Release-11.3.2~977 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7def9242b0a3662f9db595eefb15341a5c86b2b5;p=thirdparty%2Fbacula.git Update catalog to version 1023 --- diff --git a/bacula/src/cats/make_mysql_tables.in b/bacula/src/cats/make_mysql_tables.in index 9daf6a4f2..c645d449c 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -79,6 +79,7 @@ CREATE TABLE Object ); create index object_jobid_idx on Object (JobId); +create index object_type_idx on Object (ObjectCategory(255)); create index object_type_idx on Object (ObjectType(255)); create index object_name_idx on Object (ObjectName(255)); create index object_source_idx on Object (ObjectSource(255)); @@ -548,7 +549,7 @@ CREATE TABLE Version ( ); -- Initialize Version -INSERT INTO Version (VersionId) VALUES (1022); +INSERT INTO Version (VersionId) VALUES (1023); END-OF-DATA then diff --git a/bacula/src/cats/make_postgresql_tables.in b/bacula/src/cats/make_postgresql_tables.in index 27abc86eb..5d83cd9bf 100644 --- a/bacula/src/cats/make_postgresql_tables.in +++ b/bacula/src/cats/make_postgresql_tables.in @@ -62,6 +62,7 @@ CREATE TABLE Object ); create index object_jobid_idx on Object (JobId); +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); @@ -549,7 +550,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 (1022); +INSERT INTO Version (VersionId) VALUES (1023); -- 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 fef712521..07d50a185 100644 --- a/bacula/src/cats/make_sqlite3_tables.in +++ b/bacula/src/cats/make_sqlite3_tables.in @@ -59,6 +59,7 @@ CREATE TABLE Object ); create index object_jobid_idx on Object (JobId); +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); @@ -542,7 +543,7 @@ INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES ('I', 'Incomplete Job',25); -- Initialize Version -INSERT INTO Version (VersionId) VALUES (1022); +INSERT INTO Version (VersionId) VALUES (1023); 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 3178ac588..8bfd877b3 100644 --- a/bacula/src/cats/update_mysql_tables.in +++ b/bacula/src/cats/update_mysql_tables.in @@ -499,6 +499,8 @@ USE ${db_name}; ALTER TABLE FileMedia ADD FileMediaId integer auto_increment primary key; ALTER TABLE JobHisto MODIFY COLUMN JobId int PRIMARY KEY AUTO_INCREMENT; ALTER TABLE Version MODIFY COLUMN VersionId int PRIMARY KEY; +ALTER TABLE Object ADD ObjectCategory TINYBLOB NOT NULL; +create index object_type_idx on Object (ObjectCategory(255)); UPDATE Version SET VersionId=1023; END-OF-DATA then diff --git a/bacula/src/cats/update_postgresql_tables.in b/bacula/src/cats/update_postgresql_tables.in index 3f4a4b051..73aede306 100644 --- a/bacula/src/cats/update_postgresql_tables.in +++ b/bacula/src/cats/update_postgresql_tables.in @@ -562,6 +562,24 @@ END-OF-DATA fi fi +if [ "$DBVERSION" -eq 1022 ] ; then + if psql -f - -d ${db_name} $* </tmp/$$ +DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$` +if [ $DBVERSION != 1020 ] ; then + echo " " + echo "The existing database is version $DBVERSION !!" + echo "This script can only update an existing version 1020 database to version 1021." + echo "Error. Cannot upgrade this database." + echo " " + exit 1 +fi + +if mysql $* -f </tmp/$$ DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$` -if [ $DBVERSION != 1020 ] ; then +if [ $DBVERSION != 1021 ] ; then echo " " echo "The existing database is version $DBVERSION !!" - echo "This script can only update an existing version 1019 database to version 1021." + echo "This script can only update an existing version 1021 database to version 1022." echo "Error. Cannot upgrade this database." echo " " exit 1 diff --git a/bacula/updatedb/update_mysql_tables_1022_to_1023.in b/bacula/updatedb/update_mysql_tables_1022_to_1023.in new file mode 100644 index 000000000..83599c09e --- /dev/null +++ b/bacula/updatedb/update_mysql_tables_1022_to_1023.in @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Shell script to update MySQL +# +echo " " +echo "This script will update a Bacula MySQL database from version 1022 to 1023" +echo " " +bindir=@MYSQL_BINDIR@ +PATH="$bindir:$PATH" +db_name=${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 != 1022 ] ; then + echo " " + echo "The existing database is version $DBVERSION !!" + echo "This script can only update an existing version 1022 database to version 1023." + echo "Error. Cannot upgrade this database." + echo " " + exit 1 +fi + +if mysql $* -f <