From: Eric Bollengier Date: Mon, 30 Nov 2020 09:07:15 +0000 (+0100) Subject: Fix org#2584 About inconsitancies in the make_mysql_tables script X-Git-Tag: Release-9.6.7~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b8b0fbff1344734abf2bb4ae9074c2814657426;p=thirdparty%2Fbacula.git Fix org#2584 About inconsitancies in the make_mysql_tables script It is required for MariaDB 10.5 on Debian --- diff --git a/bacula/src/cats/make_mysql_tables.in b/bacula/src/cats/make_mysql_tables.in index dce3a66b9..27dfc6275 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -61,9 +61,9 @@ CREATE TABLE Path ( CREATE TABLE File ( FileId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, FileIndex INTEGER DEFAULT 0, - JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, - PathId INTEGER UNSIGNED NOT NULL REFERENCES Path, - FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename, + JobId INTEGER UNSIGNED NOT NULL, + PathId INTEGER UNSIGNED NOT NULL, + FilenameId INTEGER UNSIGNED NOT NULL, DeltaSeq SMALLINT UNSIGNED DEFAULT 0, MarkId INTEGER UNSIGNED DEFAULT 0, LStat TINYBLOB NOT NULL, @@ -83,7 +83,7 @@ CREATE TABLE RestoreObject ( ObjectIndex INTEGER DEFAULT 0, ObjectType INTEGER DEFAULT 0, FileIndex INTEGER DEFAULT 0, - JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, + JobId INTEGER UNSIGNED NOT NULL, ObjectCompression INTEGER DEFAULT 0, PRIMARY KEY(RestoreObjectId), INDEX (JobId) @@ -116,8 +116,8 @@ CREATE TABLE Storage ( CREATE TABLE Device ( DeviceId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Name TINYBLOB NOT NULL, - MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType, - StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage, + MediaTypeId INTEGER UNSIGNED DEFAULT 0, + StorageId INTEGER UNSIGNED DEFAULT 0, DevMounts INTEGER UNSIGNED DEFAULT 0, DevReadBytes BIGINT UNSIGNED DEFAULT 0, DevWriteBytes BIGINT UNSIGNED DEFAULT 0, @@ -139,7 +139,7 @@ CREATE TABLE Job ( Name TINYBLOB NOT NULL, Type BINARY(1) NOT NULL, Level BINARY(1) NOT NULL, - ClientId INTEGER DEFAULT 0 REFERENCES Client, + ClientId INTEGER UNSIGNED DEFAULT 0, JobStatus BINARY(1) NOT NULL, SchedTime DATETIME DEFAULT NULL, StartTime DATETIME DEFAULT NULL, @@ -153,9 +153,9 @@ CREATE TABLE Job ( ReadBytes BIGINT UNSIGNED DEFAULT 0, JobErrors INTEGER UNSIGNED DEFAULT 0, JobMissingFiles INTEGER UNSIGNED DEFAULT 0, - PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, - FileSetId INTEGER UNSIGNED DEFAULT 0 REFERENCES FileSet, - PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job, + PoolId INTEGER UNSIGNED DEFAULT 0, + FileSetId INTEGER UNSIGNED DEFAULT 0, + PriorJobId INTEGER UNSIGNED DEFAULT 0, PurgedFiles TINYINT DEFAULT 0, HasBase TINYINT DEFAULT 0, HasCache TINYINT DEFAULT 0, @@ -175,7 +175,7 @@ CREATE TABLE JobHisto ( Name TINYBLOB NOT NULL, Type BINARY(1) NOT NULL, Level BINARY(1) NOT NULL, - ClientId INTEGER DEFAULT 0, + ClientId INTEGER UNSIGNED DEFAULT 0, JobStatus BINARY(1) NOT NULL, SchedTime DATETIME DEFAULT NULL, StartTime DATETIME DEFAULT NULL, @@ -215,8 +215,8 @@ CREATE TABLE LocationLog ( LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Date DATETIME DEFAULT NULL, Comment BLOB NOT NULL, - MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media, - LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location, + MediaId INTEGER UNSIGNED DEFAULT 0, + LocationId INTEGER UNSIGNED DEFAULT 0, NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged', 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL, NewEnabled TINYINT, @@ -235,8 +235,8 @@ CREATE TABLE FileSet ( CREATE TABLE JobMedia ( JobMediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, - MediaId INTEGER UNSIGNED NOT NULL REFERENCES Media, + JobId INTEGER UNSIGNED NOT NULL, + MediaId INTEGER UNSIGNED NOT NULL, FirstIndex INTEGER UNSIGNED DEFAULT 0, LastIndex INTEGER UNSIGNED DEFAULT 0, StartFile INTEGER UNSIGNED DEFAULT 0, @@ -253,9 +253,9 @@ CREATE TABLE Media ( MediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, VolumeName TINYBLOB NOT NULL, Slot INTEGER DEFAULT 0, - PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + PoolId INTEGER UNSIGNED DEFAULT 0, MediaType TINYBLOB NOT NULL, - MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType, + MediaTypeId INTEGER UNSIGNED DEFAULT 0, LabelType TINYINT DEFAULT 0, FirstWritten DATETIME DEFAULT NULL, LastWritten DATETIME DEFAULT NULL, @@ -288,18 +288,18 @@ CREATE TABLE Media ( MaxVolFiles INTEGER UNSIGNED DEFAULT 0, MaxVolBytes BIGINT UNSIGNED DEFAULT 0, InChanger TINYINT DEFAULT 0, - StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage, - DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device, + StorageId INTEGER UNSIGNED DEFAULT 0, + DeviceId INTEGER UNSIGNED 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 DEFAULT 0 REFERENCES Location, + LocationId INTEGER UNSIGNED DEFAULT 0, RecycleCount INTEGER UNSIGNED DEFAULT 0, InitialWrite DATETIME DEFAULT NULL, - ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, - RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + ScratchPoolId INTEGER UNSIGNED DEFAULT 0, + RecyclePoolId INTEGER UNSIGNED DEFAULT 0, Comment BLOB, PRIMARY KEY(MediaId), UNIQUE (VolumeName(128)), @@ -328,9 +328,9 @@ CREATE TABLE Pool ( LabelType TINYINT DEFAULT 0, LabelFormat TINYBLOB, Enabled TINYINT DEFAULT 1, - ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, - RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, - NextPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + ScratchPoolId INTEGER UNSIGNED DEFAULT 0, + RecyclePoolId INTEGER UNSIGNED DEFAULT 0, + NextPoolId INTEGER UNSIGNED DEFAULT 0, MigrationHighBytes BIGINT UNSIGNED DEFAULT 0, MigrationLowBytes BIGINT UNSIGNED DEFAULT 0, MigrationTime BIGINT UNSIGNED DEFAULT 0, @@ -352,7 +352,7 @@ CREATE TABLE Client ( CREATE TABLE Log ( LogId INTEGER UNSIGNED AUTO_INCREMENT, - JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job, + JobId INTEGER UNSIGNED DEFAULT 0, Time DATETIME DEFAULT NULL, LogText BLOB NOT NULL, PRIMARY KEY(LogId), @@ -362,9 +362,9 @@ CREATE TABLE Log ( CREATE TABLE BaseFiles ( BaseId BIGINT UNSIGNED AUTO_INCREMENT, - BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job, - JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, - FileId BIGINT UNSIGNED NOT NULL REFERENCES File, + BaseJobId INTEGER UNSIGNED NOT NULL, + JobId INTEGER UNSIGNED NOT NULL, + FileId BIGINT UNSIGNED NOT NULL, FileIndex INTEGER DEFAULT 0, PRIMARY KEY(BaseId) ); @@ -373,9 +373,9 @@ CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId ); CREATE TABLE UnsavedFiles ( UnsavedId INTEGER UNSIGNED AUTO_INCREMENT, - JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, - PathId INTEGER UNSIGNED NOT NULL REFERENCES Path, - FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename, + JobId INTEGER UNSIGNED NOT NULL, + PathId INTEGER UNSIGNED NOT NULL, + FilenameId INTEGER UNSIGNED NOT NULL, PRIMARY KEY (UnsavedId) ); @@ -429,8 +429,8 @@ INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES CREATE TABLE PathHierarchy ( - PathId integer NOT NULL, - PPathId integer NOT NULL, + PathId INTEGER UNSIGNED NOT NULL, + PPathId INTEGER UNSIGNED NOT NULL, CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId) ); @@ -439,8 +439,8 @@ CREATE INDEX pathhierarchy_ppathid CREATE TABLE PathVisibility ( - PathId integer NOT NULL, - JobId integer UNSIGNED NOT NULL, + PathId INTEGER UNSIGNED NOT NULL, + JobId INTEGER UNSIGNED NOT NULL, Size int8 DEFAULT 0, Files int4 DEFAULT 0, CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)