3 # shell script to create Bacula Developer Test tables
7 if $bindir/mysql -f <<END-OF-DATA
9 CREATE TABLE Filename (
10 FilenameId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
11 Name VARCHAR(255) NOT NULL,
12 PRIMARY KEY(FilenameId),
17 PathId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
18 Path VARCHAR(255) NOT NULL,
25 FileId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
26 FileIndex INTEGER UNSIGNED NOT NULL,
27 JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
28 PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,
29 FilenameId INTEGER NOT NULL REFERENCES Filename,
30 LStat VARCHAR(255) NOT NULL,
31 MD5 VARCHAR(25) NOT NULL,
33 INDEX (FilenameId, PathId)
38 JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
39 Name VARCHAR(127) NOT NULL,
43 ClientId INTEGER NOT NULL REFERENCES Client,
44 JobStatus CHAR NOT NULL,
45 SchedTime DATETIME NOT NULL,
46 StartTime DATETIME NOT NULL,
47 EndTime DATETIME NOT NULL,
48 VolSessionId INTEGER UNSIGNED NOT NULL,
49 VolSessionTime INTEGER UNSIGNED NOT NULL,
50 JobFiles INTEGER UNSIGNED NOT NULL,
51 JobBytes BIGINT UNSIGNED NOT NULL,
52 JobErrors INTEGER UNSIGNED NOT NULL,
53 JobMissingFiles INTEGER UNSIGNED NOT NULL,
54 PoolId INTEGER UNSIGNED NOT NULL REFERENCES Pool,
55 FileSetId INTEGER UNSIGNED NOT NULL REFERENCES FileSet,
61 CREATE TABLE FileSet (
62 FileSetId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
65 PRIMARY KEY(FileSetId)
68 CREATE TABLE JobMedia (
69 JobMediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
70 JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
71 MediaId INTEGER UNSIGNED NOT NULL REFERENCES Media,
72 FirstIndex INTEGER UNSIGNED NOT NULL,
73 LastIndex INTEGER UNSIGNED NOT NULL,
74 StartFile INTEGER UNSIGNED NOT NULL,
75 EndFile INTEGER UNSIGNED NOT NULL,
76 StartBlock INTEGER UNSIGNED NOT NULL,
77 EndBlock INTEGER UNSIGNED NOT NULL,
78 PRIMARY KEY(JobMediaId),
79 INDEX (JobId, MediaId)
84 MediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
85 VolumeName VARCHAR(127) NOT NULL,
86 PoolId INTEGER UNSIGNED NOT NULL REFERENCES Pool,
87 MediaType VARCHAR(127),
88 FirstWritten DATETIME NOT NULL,
89 LastWritten DATETIME NOT NULL,
90 LabelDate DATETIME NOT NULL,
91 VolJobs INTEGER UNSIGNED NOT NULL,
92 VolFiles INTEGER UNSIGNED NOT NULL,
93 VolBlocks INTEGER UNSIGNED NOT NULL,
94 VolMounts INTEGER UNSIGNED NOT NULL,
95 VolBytes BIGINT UNSIGNED NOT NULL,
96 VolErrors INTEGER UNSIGNED NOT NULL,
97 VolWrites INTEGER UNSIGNED NOT NULL,
98 VolMaxBytes BIGINT UNSIGNED NOT NULL,
99 VolCapacityBytes BIGINT UNSIGNED NOT NULL,
100 VolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Read-Only', 'Disabled') NOT NULL,
101 Recycle ENUM('No', 'Yes') Not NULL,
102 PRIMARY KEY(MediaId),
107 PoolId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
108 Name VARCHAR(127) NOT NULL,
109 NumVols INTEGER UNSIGNED NOT NULL,
110 MaxVols INTEGER UNSIGNED NOT NULL,
111 UseOnce TINYINT NOT NULL,
112 UseCatalog TINYINT NOT NULL,
113 AcceptAnyVolume TINYINT NOT NULL,
114 PoolType ENUM('Backup', 'Copy', 'Cloned', 'Archive', 'Migration') NOT NULL,
115 LabelFormat VARCHAR(127),
121 CREATE TABLE Client (
122 ClientId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
123 Name VARCHAR(127) NOT NULL,
124 Uname VARCHAR(255) NOT NULL, /* full uname -a of client */
126 PRIMARY KEY(ClientId)
130 #CREATE TABLE FileSave (
131 # FileSaveId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
132 # FileIndex INTEGER UNSIGNED NOT NULL,
133 # JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
134 # FileId INTEGER UNSIGNED NOT NULL REFERENCES File,
135 # VLStat VARCHAR(255) NOT NULL,
136 # PRIMARY KEY(FileSaveId),
139 #CREATE TABLE LongName (
140 # LongNameId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
141 # Name TEXT NOT NULL,
142 # PRIMARY KEY (LongNameId)
148 echo "Creation of Baculatest tables succeeded."
150 echo "Creation of Baculatest tables failed."