*/
/* Current database version number for all drivers */
-#define BDB_VERSION 1025
+#define BDB_VERSION 1026
typedef void (DB_LIST_HANDLER)(void *, const char *);
typedef int (DB_RESULT_HANDLER)(void *, int, char **);
(EmailSubject, EmailBodyPreview, EmailTo, EmailCc, EmailFrom);
CREATE INDEX meta_emailowner ON MetaEmail (EmailTenant(255), EmailOwner(255));
CREATE INDEX meta_emailtime on MetaEmail (EmailTime);
+CREATE INDEX meta_emailid on MetaEmail (EmailId);
CREATE INDEX meta_emailtags on MetaEmail (EmailTags(255));
CREATE INDEX meta_emailfoldername on MetaEmail (EmailFolderName(255));
CREATE INDEX meta_emailconversationid on MetaEmail (EmailConversationId(255));
);
-- Initialize Version
-INSERT INTO Version (VersionId) VALUES (1025);
+INSERT INTO Version (VersionId) VALUES (1026);
END-OF-DATA
then
CREATE INDEX meta_emailowner on MetaEmail (EmailTenant, EmailOwner);
CREATE INDEX meta_emailtime on MetaEmail (EmailTime);
+CREATE INDEX meta_emailid on MetaEmail (EmailId);
CREATE INDEX meta_emailtags on MetaEmail (EmailTags);
CREATE INDEX meta_emailfoldername on MetaEmail (EmailFolderName);
-- CREATE INDEX meta_emailsender on MetaEmail (EmailSender);
Volume text_pattern_ops,
Name text_pattern_ops);
-INSERT INTO Version (VersionId) VALUES (1025);
+INSERT INTO Version (VersionId) VALUES (1026);
COMMIT;
CREATE INDEX meta_emailowner on MetaEmail (EmailTenant, EmailOwner);
CREATE INDEX meta_emailtime on MetaEmail (EmailTime);
+CREATE INDEX meta_emailid on MetaEmail (EmailId);
CREATE INDEX meta_emailtags on MetaEmail (EmailTags);
CREATE INDEX meta_emailfoldername on MetaEmail (EmailFolderName);
-- CREATE INDEX meta_emailsender on MetaEmail (EmailSender);
('W', 'Terminated normally with warnings',25);
-- Initialize Version
-INSERT INTO Version (VersionId) VALUES (1025);
+INSERT INTO Version (VersionId) VALUES (1026);
PRAGMA default_cache_size = 100000;
PRAGMA synchronous = NORMAL;
# Shell script to update MySQL tables to Bacula version 15.0.x
#
-OLDVERSION=1024
-NEWVERSION=1025
+OLDVERSION=1025
+NEWVERSION=1026
echo " "
echo "This script will update a Bacula MySQL database"
ALTER TABLE RestoreObject MODIFY ObjectName MEDIUMBLOB;
ALTER TABLE RestoreObject MODIFY PluginName BLOB;
ALTER TABLE Object MODIFY PluginName BLOB;
-
+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 1025');
UPDATE Version SET VersionId=1025;
END-OF-DATA
then
fi
fi
+
+if [ "$DBVERSION" -eq 1025 ] ; then
+ if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+CREATE INDEX meta_emailid on MetaEmail (EmailId);
+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 1026');
+UPDATE Version SET VersionId=1026;
+END-OF-DATA
+ then
+ echo "Update of Bacula MySQL tables 1025 to 1026 succeeded."
+ getVersion
+ else
+ echo "Update of Bacula MySQL tables 1025 to 1026 failed."
+ exit 1
+ fi
+fi
+
exit 0
# License: BSD 2-Clause; see file LICENSE-FOSS
#
-OLDVERSION=1024
-NEWVERSION=1025
+OLDVERSION=1025
+NEWVERSION=1026
echo " "
echo "This script will update a Bacula PostgreSQL database"
('q', 'Queued waiting for device',15);
INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
('W', 'Terminated normally with warnings',25);
-
+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 1025');
UPDATE Version SET VersionId=1025;
commit;
END-OF-DATA
fi
fi
+
+if [ "$DBVERSION" -eq 1025 ] ; then
+ if psql -f - -d ${db_name} $* <<END-OF-DATA
+begin;
+CREATE INDEX meta_emailid on MetaEmail (EmailId);
+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 1026');
+UPDATE Version SET VersionId=1026;
+commit;
+END-OF-DATA
+ then
+ echo "Update of Bacula PostgreSQL tables 1025 to 1026 succeeded."
+ getVersion
+ else
+ echo "Update of Bacula PostgreSQL tables 1025 to 1026 failed."
+ exit 1
+ fi
+fi
+
#
# For all versions, we need to create the Index on Media(PoolId/StorageId)
# It may fail, but it's not a big problem
--- /dev/null
+#!/bin/sh
+#
+# Copyright (C) 2000-2022 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 1025 to 1026"
+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 != 1024 ] ; then
+ echo " "
+ echo "The existing database is version $DBVERSION !!"
+ echo "This script can only update an existing version 1025 database to version 1026."
+ echo "Error. Cannot upgrade this database."
+ echo " "
+ exit 1
+fi
+
+if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+CREATE INDEX meta_emailid on MetaEmail (EmailId);
+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 1025');
+
+UPDATE Version SET VersionId=1026;
+END-OF-DATA
+then
+ echo "Update of Bacula MySQL tables 1025 to 1026 succeeded."
+ getVersion
+else
+ echo "Update of Bacula MySQL tables 1025 to 1026 failed."
+ exit 1
+fi
+
+exit 0
--- /dev/null
+#!/bin/sh
+#
+# Copyright (C) 2000-2022 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+#
+echo " "
+echo "This script will update a Bacula PostgreSQL database from version 1025 to 1026"
+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 != 1024 ] ; then
+ echo " "
+ echo "The existing database is version $DBVERSION !!"
+ echo "This script can only update an existing version 1025 database to version 1026."
+ echo "Error. Cannot upgrade this database."
+ echo " "
+ exit 1
+fi
+
+if psql -f - -d ${db_name} $* <<END-OF-DATA
+begin;
+CREATE INDEX meta_emailid on MetaEmail (EmailId);
+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 1026');
+UPDATE Version SET VersionId=1026;
+commit;
+END-OF-DATA
+then
+ echo "Update of Bacula PostgreSQL tables 1025 to 1026 succeeded."
+else
+ echo "Update of Bacula PostgreSQL tables 1025 to 1026 failed."
+ exit 1
+fi
+
+exit 0