From: Eric Bollengier Date: Thu, 29 Oct 2020 14:44:50 +0000 (+0100) Subject: Add event record at the end of the Catalog upgrade X-Git-Tag: Release-11.3.2~883 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1da7d51ab28f50f4d707072ac4c31f91e863f7f1;p=thirdparty%2Fbacula.git Add event record at the end of the Catalog upgrade This event can help administrators to track changes that were done to the catalog. It can be reviewed with a SQL command or the "list events" command. --- diff --git a/bacula/src/cats/update_mysql_tables.in b/bacula/src/cats/update_mysql_tables.in index 431afdf53..d269037cf 100644 --- a/bacula/src/cats/update_mysql_tables.in +++ b/bacula/src/cats/update_mysql_tables.in @@ -5,9 +5,13 @@ # # Shell script to update MySQL tables from Bacula Enterprise version from 4.0.x to 12.6.x # + +OLDVERSION=1022 +NEWVERSION=1023 + echo " " echo "This script will update a Bacula MySQL database" -echo " from any from version 12-15 or 1014-1021 to version 1023" +echo " from any from version 12-15 or 1014-$OLDVERSION to version $NEWVERSION" echo " which is needed to convert from any Bacula Enterprise" echo " version 4.0.x or later to version 12.6.x" echo " or Bacula Community versions 5.0.x, 5.2.x, 7.4.x, 9.x.x to" @@ -45,11 +49,11 @@ if [ "x$DBVERSION" = x ]; then exit 1 fi -if [ "$DBVERSION" -lt 1014 -o "$DBVERSION" -gt 1022 ] ; then +if [ "$DBVERSION" -lt 1014 -o "$DBVERSION" -gt $OLDVERSION ] ; then if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 16 ] ; then echo " " echo "The existing database is version $DBVERSION !!" - echo "This script can only update an existing version 12-16 or 1014-1022 database to version 1023." + echo "This script can only update an existing version 12-16 or 1014-$OLDVERSION database to version $NEWVERSION." echo "Error. Cannot upgrade this database." echo " " exit 1 @@ -500,6 +504,8 @@ 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)); +INSERT INTO Events (EventsCode, EventsType, EventsTime, EventsDaemon, EventsSource, EventsRef, EventsText) VALUES + ('DU0001', 'catalog_update', NOW(), '*SHELL*', 'update_bacula_tables', 'pid$$', 'Catalog schema was updated to 1023'); 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 59b1f4ff4..a2acd488e 100644 --- a/bacula/src/cats/update_postgresql_tables.in +++ b/bacula/src/cats/update_postgresql_tables.in @@ -3,9 +3,13 @@ # Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # + +OLDVERSION=1022 +NEWVERSION=1023 + echo " " echo "This script will update a Bacula PostgreSQL database" -echo " from any from version 12-16 or 1014-1021 to version 1023" +echo " from any from version 12-16 or 1014-$OLDVERSION to version $NEWVERSION" echo " which is needed to convert from any Bacula Enterprise" echo " version 4.0.x, 6.x.y, 8.x.y, 10.x.y to version 12.6.x" echo " " @@ -45,11 +49,11 @@ if [ "x$DBVERSION" = x ]; then exit 1 fi -if [ "$DBVERSION" -lt 1014 -o "$DBVERSION" -gt 1022 ] ; then +if [ "$DBVERSION" -lt 1014 -o "$DBVERSION" -gt $OLDVERSION ] ; then if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 16 ] ; then echo " " echo "The existing database is version $DBVERSION !!" - echo "This script can only update an existing version 12-16, 1014-1022 database to version 1023." + echo "This script can only update an existing version 12-16, 1014-$OLDVERSION database to version $NEWVERSION." echo "Error. Cannot update this database." echo " " exit 1 @@ -567,6 +571,8 @@ if [ "$DBVERSION" -eq 1022 ] ; then begin; ALTER TABLE Object ADD COLUMN ObjectCategory text not null; create index object_category_idx on Object (ObjectCategory); +INSERT INTO Events (EventsCode, EventsType, EventsTime, EventsDaemon, EventsSource, EventsRef, EventsText) VALUES + ('DU0001', 'catalog_update', NOW(), '*SHELL*', 'update_bacula_tables', 'pid$$', 'Catalog schema was updated to 1023'); UPDATE Version SET VersionId=1023; commit; END-OF-DATA diff --git a/bacula/src/cats/update_sqlite3_tables.in b/bacula/src/cats/update_sqlite3_tables.in index 34641cc28..542327da5 100644 --- a/bacula/src/cats/update_sqlite3_tables.in +++ b/bacula/src/cats/update_sqlite3_tables.in @@ -5,10 +5,13 @@ # # Shell script to update SQLite3 tables from Bacula # +OLDVERSION=1022 +NEWVERSION=1023 + echo " " -echo "This script will update a Bacula SQLite3 database from version 12-16 to 1022" -echo " which is needed to convert from Bacula Enterprise version 4.0.x to 12.4.x" -echo " or Bacula Community version 5.0.x, 5.2.x, 6.0.x to 11.0.x" +echo "This script will update a Bacula SQLite3 database from version 12-14,$OLDVERSION to $NEWVERSION" +echo " which is needed to convert from Bacula Enterprise version 4.0.x to 12.6.x" +echo " or Bacula Community version 5.0.x, 5.2.x, 7.0.x, 9.x to 11.2.x" echo " " bindir=@SQLITE_BINDIR@ @@ -20,11 +23,11 @@ DBVERSION=`sqlite3 ${db_name}.db <