From: <gi...@ba...> - 2016-06-01 12:54:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Bacula Community source". The branch, Branch-7.4 has been updated via 570fc0400e0b992f0d29ece416ab002f742a1399 (commit) from 249bd5957b9dbd8471907338e45087bdaa8c688a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 570fc0400e0b992f0d29ece416ab002f742a1399 Author: Kern Sibbald <ke...@si...> Date: Wed Jun 1 14:54:19 2016 +0200 In updatedb get recent update_xx_tables and remove old versions ----------------------------------------------------------------------- Summary of changes: diff --git a/bacula/updatedb/update_mysql_tables.in b/bacula/updatedb/update_mysql_tables.in index 4ae0513..08df0d8 100644 --- a/bacula/updatedb/update_mysql_tables.in +++ b/bacula/updatedb/update_mysql_tables.in @@ -143,7 +143,4 @@ END-OF-DATA fi fi - -END-OF-DATA - exit 0 diff --git a/bacula/updatedb/update_mysql_tables_12_to_13.in b/bacula/updatedb/update_mysql_tables_12_to_13.in deleted file mode 100644 index 2590e3d..0000000 --- a/bacula/updatedb/update_mysql_tables_12_to_13.in +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2000-2015 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 12 to 13" -echo " which is needed to convert from Bacula" -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 != 12 ] ; then - echo " " - echo "The existing database is version $DBVERSION !!" - echo "This script can only update an existing version 12 database to version 13." - echo "Error. Cannot upgrade this database." - echo " " - exit 1 -fi - -if mysql $* -f <<END-OF-DATA -USE ${db_name}; -CREATE TABLE RestoreObject ( - RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - ObjectName BLOB NOT NULL, - RestoreObject LONGBLOB NOT NULL, - PluginName TINYBLOB NOT NULL, - ObjectLength INTEGER DEFAULT 0, - ObjectFullLength INTEGER DEFAULT 0, - ObjectIndex INTEGER DEFAULT 0, - ObjectType INTEGER DEFAULT 0, - FileIndex INTEGER UNSIGNED DEFAULT 0, - JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, - ObjectCompression INTEGER DEFAULT 0, - PRIMARY KEY(RestoreObjectId), - INDEX (JobId) -); - -CREATE INDEX jobhisto_jobid_idx ON JobHisto (JobId); -UPDATE Version SET VersionId=13; -END-OF-DATA -then - echo "Update of Bacula MySQL tables succeeded." -else - echo "Update of Bacula MySQL tables failed." -fi -exit 0 diff --git a/bacula/updatedb/update_mysql_tables_13_to_14.in b/bacula/updatedb/update_mysql_tables_13_to_14.in deleted file mode 100644 index a51f171..0000000 --- a/bacula/updatedb/update_mysql_tables_13_to_14.in +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2000-2015 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 13 to 14" -echo " which is needed to convert from Bacula" -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 != 13 ] ; then - echo " " - echo "The existing database is version $DBVERSION !!" - echo "This script can only update an existing version 13 database to version 14." - echo "Error. Cannot upgrade this database." - echo " " - exit 1 -fi - -if mysql $* -f <<END-OF-DATA -USE ${db_name}; -ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0; -UPDATE Version SET VersionId=14; -END-OF-DATA -then - echo "Update of Bacula MySQL tables succeeded." -else - echo "Update of Bacula MySQL tables failed." -fi -exit 0 diff --git a/bacula/updatedb/update_postgresql_tables.in b/bacula/updatedb/update_postgresql_tables.in index c3db92a..6690d60 100644 --- a/bacula/updatedb/update_postgresql_tables.in +++ b/bacula/updatedb/update_postgresql_tables.in @@ -63,7 +63,7 @@ CREATE TABLE RestoreObject ( ); CREATE INDEX restore_jobid_idx on RestoreObject(JobId); -UPDATE Version SET VersionId=12; +UPDATE Version SET VersionId=13; COMMIT; END-OF-DATA diff --git a/bacula/updatedb/update_postgresql_tables_12_to_13.in b/bacula/updatedb/update_postgresql_tables_12_to_13.in deleted file mode 100644 index 47e0809..0000000 --- a/bacula/updatedb/update_postgresql_tables_12_to_13.in +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2000-2015 Kern Sibbald -# License: BSD 2-Clause; see file LICENSE-FOSS -# -# Shell script to update PostgreSQL tables from Bacula -# -echo " " -echo "This script will update a Bacula PostgreSQL database from version 12 to 13" -echo " which is needed to convert from Bacula" -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 != 12 ] ; then - echo " " - echo "The existing database is version $DBVERSION !!" - echo "This script can only update an existing version 12 database to version 13." - echo "Error. Cannot upgrade this database." - echo " " - exit 1 -fi - -if psql -f - -d ${db_name} $* <<END-OF-DATA -BEGIN; -- Necessary for Bacula core -CREATE TABLE RestoreObject ( - RestoreObjectId SERIAL NOT NULL, - ObjectName TEXT NOT NULL, - RestoreObject BYTEA NOT NULL, - PluginName TEXT NOT NULL, - ObjectLength INTEGER DEFAULT 0, - ObjectFullLength INTEGER DEFAULT 0, - ObjectIndex INTEGER DEFAULT 0, - ObjectType INTEGER DEFAULT 0, - FileIndex INTEGER DEFAULT 0, - JobId INTEGER, - ObjectCompression INTEGER DEFAULT 0, - PRIMARY KEY(RestoreObjectId) - ); - -CREATE INDEX restore_jobid_idx on RestoreObject(JobId); -UPDATE Version SET VersionId=13; -COMMIT; -END-OF-DATA -then - echo "Update of Bacula PostgreSQL tables succeeded." -else - echo "Update of Bacula PostgreSQL tables failed." -fi -exit 0 diff --git a/bacula/updatedb/update_postgresql_tables_13_to_14.in b/bacula/updatedb/update_postgresql_tables_13_to_14.in deleted file mode 100644 index 1ffdc21..0000000 --- a/bacula/updatedb/update_postgresql_tables_13_to_14.in +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2000-2015 Kern Sibbald -# License: BSD 2-Clause; see file LICENSE-FOSS -# -# Shell script to update PostgreSQL tables from Bacula -# -echo " " -echo "This script will update a Bacula PostgreSQL database from version 13 to 14" -echo " which is needed to convert from Bacula" -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 != 13 ] ; then - echo " " - echo "The existing database is version $DBVERSION !!" - echo "This script can only update an existing version 13 database to version 14." - echo "Error. Cannot upgrade this database." - echo " " - exit 1 -fi - -if psql -f - -d ${db_name} $* <<END-OF-DATA -BEGIN; -- Necessary for Bacula core -ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0; -UPDATE Version SET VersionId=14; -COMMIT; -END-OF-DATA -then - echo "Update of Bacula PostgreSQL tables succeeded." -else - echo "Update of Bacula PostgreSQL tables failed." -fi -exit 0 diff --git a/bacula/updatedb/update_sqlite3_tables.in b/bacula/updatedb/update_sqlite3_tables.in index 0f1f15a..bd468c6 100644 --- a/bacula/updatedb/update_sqlite3_tables.in +++ b/bacula/updatedb/update_sqlite3_tables.in @@ -3,11 +3,11 @@ # Copyright (C) 2000-2015 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # -# Shell script to update MySQL tables from Bacula Community version +# Shell script to update SQLite tables from Bacula Community version # 5.0.x, 5.2.x, 7.0.x # echo " " -echo "This script will update a Bacula MySQL database from version 12-14 to 15" +echo "This script will update a Bacula SQLite database from version 12-14 to 15" echo " " echo "Depending on the current version of your catalog, you may have to run this script" echo " multiple times" @@ -76,19 +76,70 @@ fi if [ "$DBVERSION" = 14 ] ; then sqlite3 $* ${db_name}.db <<END-OF-DATA +BEGIN; + INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES ('I', 'Incomplete Job',25); -ALTER TABLE Media ADD COLUMN VolABytes BIGINT UNSIGNED DEFAULT 0; -ALTER TABLE Media ADD COLUMN VolAPadding BIGINT UNSIGNED DEFAULT 0; -ALTER TABLE Media ADD COLUMN VolHoleBytes BIGINT UNSIGNED DEFAULT 0; -ALTER TABLE Media ADD COLUMN VolHoles INTEGER UNSIGNED DEFAULT 0; -ALTER TABLE Media CHANGE VolWrites VolWrites BIGINT UNSIGNED; + +CREATE TABLE new_Media ( + MediaId INTEGER, + VolumeName VARCHAR(128) NOT NULL, + Slot INTEGER DEFAULT 0, + PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + MediaType VARCHAR(128) NOT NULL, + MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0, + LabelType TINYINT DEFAULT 0, + FirstWritten DATETIME DEFAULT 0, + LastWritten DATETIME DEFAULT 0, + LabelDate DATETIME DEFAULT 0, + VolJobs INTEGER UNSIGNED DEFAULT 0, + VolFiles INTEGER UNSIGNED DEFAULT 0, + VolBlocks INTEGER UNSIGNED DEFAULT 0, + VolMounts INTEGER UNSIGNED DEFAULT 0, + VolBytes BIGINT UNSIGNED DEFAULT 0, + VolParts INTEGER UNSIGNED DEFAULT 0, + VolErrors INTEGER UNSIGNED DEFAULT 0, + VolWrites BIGINT UNSIGNED DEFAULT 0, + VolCapacityBytes BIGINT UNSIGNED DEFAULT 0, + VolStatus VARCHAR(20) NOT NULL, + Enabled TINYINT DEFAULT 1, + Recycle TINYINT DEFAULT 0, + ActionOnPurge TINYINT DEFAULT 0, + VolRetention BIGINT UNSIGNED DEFAULT 0, + VolUseDuration BIGINT UNSIGNED DEFAULT 0, + MaxVolJobs INTEGER UNSIGNED DEFAULT 0, + MaxVolFiles INTEGER UNSIGNED DEFAULT 0, + MaxVolBytes BIGINT UNSIGNED DEFAULT 0, + InChanger TINYINT DEFAULT 0, + StorageId INTEGER UNSIGNED REFERENCES Storage DEFAULT 0, + DeviceId INTEGER UNSIGNED REFERENCES Device DEFAULT 0, + MediaAddressing TINYINT DEFAULT 0, + VolReadTime BIGINT UNSIGNED DEFAULT 0, + VolWriteTime BIGINT UNSIGNED DEFAULT 0, + EndFile INTEGER UNSIGNED DEFAULT 0, + EndBlock INTEGER UNSIGNED DEFAULT 0, + LocationId INTEGER UNSIGNED REFERENCES Location DEFAULT 0, + RecycleCount INTEGER UNSIGNED DEFAULT 0, + InitialWrite DATETIME DEFAULT 0, + ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + Comment TEXT, + VolABytes BIGINT UNSIGNED DEFAULT 0, + VolAPadding BIGINT UNSIGNED DEFAULT 0, + VolHoleBytes BIGINT UNSIGNED DEFAULT 0, + VolHoles INTEGER UNSIGNED DEFAULT 0, + PRIMARY KEY(MediaId) + ); +INSERT INTO new_Media (MediaId, VolumeName, Slot, PoolId, MediaType, MediaTypeId, LabelType, FirstWritten, LastWritten, LabelDate, VolJobs, VolFiles, VolBlocks, VolMounts, VolBytes, VolParts, VolErrors, VolWrites, VolCapacityBytes, VolStatus, Enabled, Recycle, ActionOnPurge, VolRetention, VolUseDuration, MaxVolJobs, MaxVolFiles, MaxVolBytes, InChanger, StorageId, DeviceId, MediaAddressing, VolReadTime, VolWriteTime, EndFile, EndBlock, LocationId, RecycleCount, InitialWrite, ScratchPoolId, RecyclePoolId, Comment) SELECT MediaId, VolumeName, Slot, PoolId, MediaType, MediaTypeId, LabelType, FirstWritten, LastWritten, LabelDate, VolJobs, VolFiles, VolBlocks, VolMounts, VolBytes, VolParts, VolErrors, VolWrites, VolCapacityBytes, VolStatus, Enabled, Recycle, ActionOnPurge, VolRetention, VolUseDuration, MaxVolJobs, MaxVolFiles, MaxVolBytes, InChanger, StorageId, DeviceId, MediaAddressing, VolReadTime, VolWriteTime, EndFile, EndBlock, LocationId, RecycleCount, InitialWrite, ScratchP oolId, RecyclePoolId, Comment FROM Media; +DROP TABLE Media; +ALTER TABLE new_Media RENAME TO Media; +CREATE INDEX inx8 ON Media (PoolId); CREATE TABLE Snapshot ( SnapshotId INTEGER UNSIGNED AUTO_INCREMENT, Name TINYBLOB NOT NULL, JobId INTEGER UNSIGNED DEFAULT 0, - FileSetId INTEGER UNSIGNED DEFAULT 0; + FileSetId INTEGER UNSIGNED DEFAULT 0, CreateTDate BIGINT NOT NULL, CreateDate DATETIME NOT NULL, ClientId INTEGER DEFAULT 0, @@ -100,13 +151,13 @@ CREATE TABLE Snapshot ( primary key (SnapshotId) ); -CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device(255), Volume(255), Name(255)); +CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device, Volume, Name); CREATE INDEX jobtdate_idx on JobHisto (JobTDate); UPDATE Version SET VersionId=15; + +COMMIT; END-OF-DATA DBVERSION=15 fi - -END-OF-DATA hooks/post-receive -- Bacula Community source |