]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Add event record at the end of the Catalog upgrade
authorEric Bollengier <eric@baculasystems.com>
Thu, 29 Oct 2020 14:44:50 +0000 (15:44 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:58 +0000 (09:02 +0100)
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.

bacula/src/cats/update_mysql_tables.in
bacula/src/cats/update_postgresql_tables.in
bacula/src/cats/update_sqlite3_tables.in
bacula/updatedb/update_mysql_tables_1022_to_1023.in
bacula/updatedb/update_postgresql_tables_1022_to_1023.in

index 431afdf530a2ae5d61544b1e163325b4a17a3e46..d269037cfe79834da501e71b23c0b97d922a6c6a 100644 (file)
@@ -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
index 59b1f4ff4b61112dbedf43e9154253ddb0512e42..a2acd488e56e4ac24077acff1cbe0032ca89a99d 100644 (file)
@@ -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
index 34641cc287dc519650da86e84d536b3843e5ee31..542327da568d163239cd4d6c08077f44d7ce5239 100644 (file)
@@ -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 <<END
 SELECT VersionId FROM Version LIMIT 1;
 END
 `
-if [ "$DBVERSION" -ne 1022 ] ; then
-  if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 16 ] ; then
+if [ "$DBVERSION" -ne $OLDVERSION ] ; then
+  if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 14 ] ; then
     echo " "
     echo "The existing database is version $DBVERSION !!"
-    echo "This script can only update an existing version 12-16 database to version 1022."
+    echo "This script can only update an existing version 12, 13, 14 or 1014-$OLDVERSION database to version $NEWVERSION."
     echo "Error. Cannot upgrade this database."
     echo " "
     exit 1
@@ -474,6 +477,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
index 22f8ac6ee9061993138e132bda321d30dbd623e3..7041c0854932fc1784e03e2e11675dddc66cbe5d 100644 (file)
@@ -30,6 +30,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_category_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
index faf04bf0e616c21be3ebf5ab78e06a0f5b27a10b..afadab30338e5afb4495b59e56de589cd2f7795c 100644 (file)
@@ -26,6 +26,8 @@ if psql -f - -d ${db_name} $* <<END-OF-DATA
 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