# shell script to create Bacula MySQL tables
#
bindir=@SQL_BINDIR@
+db_name=@db_name@
if $bindir/mysql $* -f <<END-OF-DATA
-USE bacula;
+USE ${db_name};
--
-- Note, we use BLOB rather than TEXT because in MySQL,
-- BLOBs are identical to TEXT except that BLOB is case
LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
Location TINYBLOB NOT NULL,
Cost INTEGER DEFAULT 0,
+ Enabled TINYINT,
PRIMARY KEY(LocationId)
);
+CREATE TABLE LocationLog (
+ LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ Date DATETIME DEFAULT 0,
+ Comment BLOB NOT NULL,
+ MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media,
+ LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,
+ NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',
+ 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,
+ NewEnabled TINYINT,
+ PRIMARY KEY(LocLogId)
+);
+
+
#
CREATE TABLE FileSet (
FileSetId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
InitialWrite DATETIME DEFAULT 0,
ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
+ Comment BLOB,
PRIMARY KEY(MediaId),
INDEX (PoolId)
);
);
CREATE TABLE Log (
- JobId INTEGER INTEGER UNSIGNED DEFAULT 0 REFERENCES JobId,
+ LogId INTEGER UNSIGNED AUTO_INCREMENT,
+ JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,
+ Time DATETIME DEFAULT 0,
LogText BLOB NOT NULL,
+ PRIMARY KEY(LogId),
INDEX (JobId)
);