]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/make_sqlite3_tables.in
ebl Modify disk-changer to check if slot contains something before
[bacula/bacula] / bacula / src / cats / make_sqlite3_tables.in
index 7e49d713a2054f8ac0a54f38c7054359f4de07ce..aea3628f6e8f3b105735696a2dc6c6f9c045d915 100644 (file)
@@ -4,9 +4,10 @@
 
 bindir=@SQL_BINDIR@
 cd @working_dir@
-sqlite=@DB_NAME@
+sqlite=@DB_TYPE@
+db_name=@db_name@
 
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
+${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA
 CREATE TABLE Filename (
   FilenameId INTEGER,
   Name TEXT DEFAULT "",
@@ -72,17 +73,40 @@ CREATE TABLE Job (
    HasBase TINYINT DEFAULT 0,
    PRIMARY KEY(JobId) 
    );
-
 CREATE INDEX inx6 ON Job (Name);
 
+-- Create a table like Job for long term statistics 
+CREATE TABLE JobStat (LIKE Job);
+
 CREATE TABLE Location (
    LocationId INTEGER,
-   Location TINYBLOB NOT NULL,
+   Location TEXT NOT NULL,
    Cost INTEGER DEFAULT 0,
    Enabled TINYINT,
    PRIMARY KEY(LocationId)
    );
 
+CREATE TABLE LocationLog (
+   LocLogId INTEGER,
+   Date DATETIME NOT NULL,
+   Comment TEXT NOT NULL,
+   MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0,
+   LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0,
+   NewVolStatus VARCHAR(20) NOT NULL,
+   NewEnabled TINYINT NOT NULL,
+   PRIMARY KEY(LocLogId)
+);
+
+
+CREATE TABLE Log (
+   LogId INTEGER,
+   JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+   Time DATETIME NOT NULL,
+   LogText TEXT NOT NULL,
+   PRIMARY KEY(LogId) 
+   );
+CREATE INDEX LogInx1 ON Log (JobId);
+
 
 CREATE TABLE FileSet (
    FileSetId INTEGER,
@@ -151,6 +175,7 @@ CREATE TABLE Media (
    InitialWrite DATETIME DEFAULT 0,
    ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
    RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+   Comment TEXT,
    PRIMARY KEY(MediaId)
    );
 
@@ -255,12 +280,7 @@ CREATE TABLE NextId (
    PRIMARY KEY (TableName)
    );
 
-CREATE TABLE Log  
-   JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
-   LogText TEXT NOT NULL,
-   KEY (JobId)
-   );
+
 
 -- Initialize JobId to start at 1
 INSERT INTO NextId (id, TableName) VALUES (1, "Job");
@@ -330,16 +350,20 @@ INSERT INTO Status (JobStatus,JobStatusLong) VALUES
    ('t', 'Waiting on start time');
 INSERT INTO Status (JobStatus,JobStatusLong) VALUES
    ('p', 'Waiting on higher priority jobs');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+   ('a', 'SD despooling attributes');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+   ('i', 'Doing batch insert file records');
 
 
 -- Initialize Version           
 INSERT INTO Version (VersionId) VALUES (10);
 
 
-PRAGMA default_synchronous = OFF;
-PRAGMA default_cache_size = 10000;
+PRAGMA default_cache_size = 100000;
+PRAGMA synchronous = NORMAL;
 
 END-OF-DATA
 
-chmod 640 bacula.db
+chmod 640 ${db_name}.db
 exit 0