]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
catalog: update to ver 1024
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Mon, 12 Apr 2021 15:11:33 +0000 (17:11 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:01 +0000 (09:03 +0100)
13 files changed:
bacula/autoconf/configure.in
bacula/platforms/rpms/redhat/bacula.spec.in
bacula/platforms/rpms/suse/bacula.spec.in
bacula/src/cats/cats.h
bacula/src/cats/make_mysql_tables.in
bacula/src/cats/make_postgresql_tables.in
bacula/src/cats/make_sqlite3_tables.in
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_1023_to_1024.in [new file with mode: 0644]
bacula/updatedb/update_postgresql_tables_1022_to_1023.in
bacula/updatedb/update_postgresql_tables_1023_to_1024.in [new file with mode: 0644]

index 53167597ceb1ebfcb3ce2f6e2cc68acbaa762df6..26e78748d4fa2afd1de80cb7861aa1f355561884 100644 (file)
@@ -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 \
index 17fdfa586b97902a633a93f9c40c93fe630f7802..a2884f8a85c3e97ddbdfda428355f5c2374ac059 100644 (file)
@@ -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
index 5d00dbd61c2ba53fc370203d3288df1ec7437075..8f654451fffdf92a8ef633dd73f9230e4199a412 100644 (file)
@@ -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
index 6ccd4684031a221b16a96b65957ab2c92a2b9acf..e9998c73d55722faefa29a89c2070dd578562c52 100644 (file)
@@ -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 **);
index 28c87fb2fc79ef4bade6dcf8fce12c9392362fc6..96c877ff1664dffe05a90e3032d38e98a66640b8 100644 (file)
@@ -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
index f4b1c2b2ba21f06d0899cc6cc599c45a1344d2f7..9c495ad54695900bc7fd44295e861fe96238315c 100644 (file)
@@ -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
 
index 96dec7787126ce93789d8ae18e109533bce8bc1a..7e4c79fd53c6bbe78831dc9d118831fdce0c14ca 100644 (file)
@@ -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;
index be73b3e6ad50e4db40f281927d7078316838c466..3f980286da9b1e0f82dc75f7e6606ac6fa0de883 100644 (file)
@@ -523,4 +523,21 @@ END-OF-DATA
     fi
 fi
 
+if [ "$DBVERSION" -eq 1023 ] ; then
+    if mysql $* -f  <<END-OF-DATA
+USE ${db_name};
+ALTER TABLE Object ADD ObjectStatus BINARY(1) DEFAULT 'U';
+ALTER TABLE Object ADD ObjectCount  INTEGER UNSIGNED DEFAULT 1;
+create index object_status_idx on Object  (ObjectStatus);
+UPDATE Version SET VersionId=1024;
+END-OF-DATA
+    then
+        echo "Update of Bacula MySQL tables 1023 to 1024 succeeded."
+        getVersion
+    else
+        echo "Update of Bacula MySQL tables 1023 to 1024 failed."
+        exit 1
+    fi
+fi
+
 exit 0
index bd40f5181768f475a1a596157c92134117ad1cc3..20fd2f67440ab2b41f484db31d55bcc3551a00b2 100644 (file)
@@ -586,6 +586,23 @@ END-OF-DATA
     fi
 fi
 
+if [ "$DBVERSION" -eq 1023 ] ; then
+    if psql -f - -d ${db_name} $* <<END-OF-DATA
+begin;
+ALTER TABLE Object ADD COLUMN ObjectStatus char(1) default 'U';
+ALTER TABLE Object ADD COLUMN ObjectCount integer default 1;
+create index object_status_idx on Object (ObjectStatus);
+UPDATE Version SET VersionId=1024;
+commit;
+END-OF-DATA
+    then
+       echo "Update of Bacula PostgreSQL tables 1023 to 1024 succeeded."
+       getVersion
+    else
+       echo "Update of Bacula PostgreSQL tables 1023 to 1024 failed."
+       exit 1
+    fi
+fi
 
 #
 # For all versions, we need to create the Index on Media(PoolId/StorageId)
index 80fce33e434bf47050a0b54e48650a526205e0fe..e44b3d3c71bb8e64d30f765c9523010147b2e638 100644 (file)
@@ -490,3 +490,21 @@ END-OF-DATA
        exit 1
     fi
 fi
+
+if [ "$DBVERSION" -eq 1023 ] ; then
+    if sqlite3 -f - -d ${db_name} $* <<END-OF-DATA
+begin;
+ALTER TABLE Object ADD COLUMN ObjectStatus char(1) default 'U';
+ALTER TABLE Object ADD COLUMN ObjectCount integer default 1;
+create index object_status_idx on Object  (ObjectStatus);
+UPDATE Version SET VersionId=1024;
+commit;
+END-OF-DATA
+    then
+       echo "Update of Bacula SQLite3 tables 1023 to 1024 succeeded."
+       DBVERSION=1023
+    else
+       echo "Update of Bacula SQLite3 tables 1023 to 1024 failed."
+       exit 1
+    fi
+fi
diff --git a/bacula/updatedb/update_mysql_tables_1023_to_1024.in b/bacula/updatedb/update_mysql_tables_1023_to_1024.in
new file mode 100644 (file)
index 0000000..9c91169
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2021 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 1023 to 1024"
+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 != 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  <<END-OF-DATA
+USE ${db_name};
+ALTER TABLE Object ADD ObjectStatus BINARY(1) DEFAULT 'U';
+ALTER TABLE Object ADD ObjectCount  INTEGER UNSIGNED DEFAULT 1;
+create index object_status_idx on Object  (ObjectStatus);
+UPDATE Version SET VersionId=1024;
+END-OF-DATA
+then
+   echo "Update of Bacula MySQL tables 1023 to 1024 succeeded."
+   getVersion
+else
+   echo "Update of Bacula MySQL tables 1023 to 1024 failed."
+   exit 1
+fi
+
+exit 0
index afadab30338e5afb4495b59e56de589cd2f7795c..5414a254f25de0ad630563bfcfbb4fedd83601a5 100644 (file)
@@ -5,7 +5,7 @@
 #
 #
 echo " "
-echo "This script will update a Bacula PostgreSQL database from version 1020 to 1021"
+echo "This script will update a Bacula PostgreSQL database from version 1022 to 1023"
 echo " "
 
 bindir=@POSTGRESQL_BINDIR@
diff --git a/bacula/updatedb/update_postgresql_tables_1023_to_1024.in b/bacula/updatedb/update_postgresql_tables_1023_to_1024.in
new file mode 100644 (file)
index 0000000..9e93b37
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2021 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+#
+echo " "
+echo "This script will update a Bacula PostgreSQL database from version 1023 to 1024"
+echo " "
+
+bindir=@POSTGRESQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
+
+DBVERSION=`psql -d ${db_name} -t --pset format=unaligned -c "select VersionId from Version" $*`
+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 psql -f - -d ${db_name} $* <<END-OF-DATA
+begin;
+ALTER TABLE Object ADD COLUMN ObjectStatus char(1) default 'U';
+ALTER TABLE Object ADD COLUMN ObjectCount integer default 1;
+create index object_status_idx on Object (ObjectStatus);
+UPDATE Version SET VersionId=1024;
+commit;
+END-OF-DATA
+then
+   echo "Update of Bacula PostgreSQL tables 1023 to 1024 succeeded."
+   getVersion
+else
+   echo "Update of Bacula PostgreSQL tables 1023 to 1024 failed."
+   exit 1
+fi
+
+exit 0