]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/make_mysql_tables.in
ebl Modify disk-changer to check if slot contains something before
[bacula/bacula] / bacula / src / cats / make_mysql_tables.in
index 8ce92132c07862e0716d5e6ca2b5abccff1f9a50..32a5b4d9843549ca14e05942ef6a8392025bb208 100644 (file)
@@ -3,9 +3,10 @@
 # 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
@@ -114,6 +115,8 @@ CREATE TABLE Job (
    INDEX (Name(128))
    );
 
+-- Create a table like Job for long term statistics 
+CREATE TABLE JobStat (LIKE Job);
 
 CREATE TABLE Location (
    LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -123,6 +126,19 @@ CREATE TABLE Location (
    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,
@@ -192,6 +208,7 @@ CREATE TABLE Media (
    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)
    );
@@ -242,8 +259,11 @@ CREATE TABLE Client (
    );
 
 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)
    );
 
@@ -307,7 +327,9 @@ INSERT INTO Status (JobStatus,JobStatusLong) VALUES
    ('c', 'Waiting for client resource'),
    ('d', 'Waiting on maximum jobs'),
    ('t', 'Waiting on start time'),
-   ('p', 'Waiting on higher priority jobs');
+   ('p', 'Waiting on higher priority jobs'),
+   ('i', 'Doing batch insert file records'),
+   ('a', 'SD despooling attributes');
 
 CREATE TABLE Version (
    VersionId INTEGER UNSIGNED NOT NULL