Commit 0b1ea264 authored by Eric Bollengier's avatar Eric Bollengier
Browse files

Fix org#2577 Remove -f option from MySQL update scripts to detect errors properly

parent b6fdc3fe
......@@ -65,12 +65,12 @@ fi
# For all versions, we need to create the Index on Media(StorageId)
# It may fail, but it's not a big problem
# mysql $* -f <<END-OF-DATA >/dev/null 2> /dev/null
# mysql $* <<END-OF-DATA >/dev/null 2> /dev/null
# CREATE INDEX media_storageid_idx ON Media (StorageId);
# END-OF-DATA
if [ "$DBVERSION" -eq 12 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
CREATE TABLE RestoreObject (
......@@ -103,7 +103,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 13 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
......@@ -120,7 +120,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 14 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
......@@ -137,7 +137,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 1014 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE Media
......@@ -293,7 +293,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 1016 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
CREATE INDEX jobtdate_idx on JobHisto (JobTDate);
ALTER TABLE Snapshot ADD COLUMN JobId INTEGER UNSIGNED DEFAULT 0;
......@@ -310,7 +310,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 1017 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
CREATE TABLE FileMedia
(
......@@ -335,7 +335,7 @@ fi
# We are coming from version 16, so it's already done
if [ "$SKIP1018" = 1 -a "$DBVERSION" -eq 1018 ]; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE File MODIFY FileIndex INTEGER DEFAULT 0;
ALTER TABLE RestoreObject MODIFY FileIndex INTEGER DEFAULT 0;
......@@ -352,7 +352,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 1018 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE BaseFiles MODIFY COLUMN BaseId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE Media
......@@ -396,7 +396,7 @@ fi
if [ "$DBVERSION" -eq 1019 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE Pool ADD COLUMN MaxPoolBytes BIGINT UNSIGNED DEFAULT 0;
ALTER TABLE Job ADD COLUMN PriorJob TINYBLOB;
......@@ -413,7 +413,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 1020 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE File
MODIFY FileIndex INTEGER DEFAULT 0;
......@@ -433,7 +433,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 1021 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
CREATE TABLE TagJob
......@@ -512,7 +512,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 1022 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE FileMedia ADD FileMediaId integer auto_increment primary key;
ALTER TABLE JobHisto MODIFY COLUMN JobId int PRIMARY KEY AUTO_INCREMENT;
......@@ -540,7 +540,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 1023 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE Object
ADD ObjectStatus BINARY(1) DEFAULT 'U',
......
......@@ -46,12 +46,12 @@ fi
# For all versions, we need to create the Index on Media(StorageId)
# It may fail, but it's not a big problem
# mysql $* -f <<END-OF-DATA >/dev/null 2> /dev/null
# mysql $* <<END-OF-DATA >/dev/null 2> /dev/null
# CREATE INDEX media_storageid_idx ON Media (StorageId);
# END-OF-DATA
if [ "$DBVERSION" -eq 12 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
CREATE TABLE RestoreObject (
......@@ -84,7 +84,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 13 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
......@@ -101,7 +101,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 14 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
......@@ -144,7 +144,7 @@ END-OF-DATA
fi
if [ "$DBVERSION" -eq 15 ] ; then
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE BaseFiles MODIFY COLUMN BaseId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE Media CHANGE COLUMN VolParts VolType INTEGER UNSIGNED DEFAULT 0;
......
......@@ -24,7 +24,7 @@ if [ $DBVERSION != 1020 ] ; then
exit 1
fi
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
UPDATE Version SET VersionId=1021;
ALTER TABLE File
......
......@@ -23,7 +23,7 @@ if [ $DBVERSION != 1021 ] ; then
exit 1
fi
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
CREATE TABLE TagJob
(
......
......@@ -23,7 +23,7 @@ if [ $DBVERSION != 1022 ] ; then
exit 1
fi
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE FileMedia ADD FileMediaId integer auto_increment primary key;
ALTER TABLE JobHisto MODIFY COLUMN JobId int PRIMARY KEY AUTO_INCREMENT;
......
......@@ -23,7 +23,7 @@ if [ $DBVERSION != 1023 ] ; then
exit 1
fi
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE Object ADD ObjectStatus BINARY(1) DEFAULT 'U';
ALTER TABLE Object ADD ObjectCount INTEGER UNSIGNED DEFAULT 1;
......
......@@ -13,7 +13,7 @@ bindir=@MYSQL_BINDIR@
PATH="$bindir:$PATH"
db_name=${db_name:-@db_name@}
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
-- Fix bad index on Media table
......
......@@ -24,7 +24,7 @@ if [ $DBVERSION != 11 ] ; then
exit 1
fi
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
ALTER TABLE JobMedia DROP Stripe ;
......
......@@ -23,7 +23,7 @@ if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "4" ]; then
exit 1
fi
if $bindir/mysql -f <<END-OF-DATA
if $bindir/mysql <<END-OF-DATA
USE bacula;
ALTER TABLE Media ADD COLUMN VolUseDuration BIGINT UNSIGNED NOT NULL;
ALTER TABLE Media ADD COLUMN MaxVolJobs INTEGER UNSIGNED NOT NULL;
......
......@@ -23,7 +23,7 @@ if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "5" ]; then
exit 1
fi
if $bindir/mysql $* -f <<END-OF-DATA
if $bindir/mysql $* <<END-OF-DATA
USE bacula;
ALTER TABLE JobMedia ADD COLUMN VolIndex INTEGER UNSIGNED NOT NULL;
......
......@@ -23,7 +23,7 @@ if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "6" ]; then
exit 1
fi
if $bindir/mysql $* -f <<END-OF-DATA
if $bindir/mysql $* <<END-OF-DATA
USE bacula;
ALTER TABLE Media ADD COLUMN InChanger TINYINT NOT NULL DEFAULT 0;
......
......@@ -27,7 +27,7 @@ if [ -n "$DB_VER" ]; then
fi
fi
if $bindir/mysql $* -f << END_OF_DATA
if $bindir/mysql $* << END_OF_DATA
USE bacula;
ALTER TABLE Media ADD COLUMN EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0;
......
......@@ -9,7 +9,7 @@ echo "this script may take several minutes to run."
echo " "
bindir=/usr/bin
if $bindir/mysql $* -f <<END-OF-DATA
if $bindir/mysql $* <<END-OF-DATA
USE bacula;
ALTER TABLE Media ADD COLUMN LabelType INTEGER UNSIGNED NOT NULL DEFAULT 0;
......
......@@ -15,7 +15,7 @@ bindir=@MYSQL_BINDIR@
PATH="$bindir:$PATH"
db_name=${db_name:-@db_name@}
if mysql $* -f <<END-OF-DATA
if mysql $* <<END-OF-DATA
USE ${db_name};
DROP TABLE IF EXISTS MAC;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment