3 # shell script to update SQLite from version 1.34 to 1.35.5
6 echo "This script will update a Bacula SQLite database from version 7 to 8"
7 echo "Depending on the size of your database,"
8 echo "this script may take several minutes to run."
11 bindir=/home/kern/bacula/depkgs/sqlite
12 cd /home/kern/bacula/working
14 $bindir/sqlite $* bacula.db <<END-OF-DATA
17 CREATE TEMPORARY TABLE Media_backup (
18 MediaId INTEGER UNSIGNED AUTOINCREMENT,
19 VolumeName VARCHAR(128) NOT NULL,
20 Slot INTEGER DEFAULT 0,
21 PoolId INTEGER UNSIGNED REFERENCES Pool NOT NULL,
22 MediaType VARCHAR(128) NOT NULL,
23 FirstWritten DATETIME DEFAULT 0,
24 LastWritten DATETIME DEFAULT 0,
25 LabelDate DATETIME DEFAULT 0,
26 VolJobs INTEGER UNSIGNED DEFAULT 0,
27 VolFiles INTEGER UNSIGNED DEFAULT 0,
28 VolBlocks INTEGER UNSIGNED DEFAULT 0,
29 VolMounts INTEGER UNSIGNED DEFAULT 0,
30 VolBytes BIGINT UNSIGNED DEFAULT 0,
31 VolErrors INTEGER UNSIGNED DEFAULT 0,
32 VolWrites INTEGER UNSIGNED DEFAULT 0,
33 VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
34 VolStatus VARCHAR(20) NOT NULL,
35 Recycle TINYINT DEFAULT 0,
36 VolRetention BIGINT UNSIGNED DEFAULT 0,
37 VolUseDuration BIGINT UNSIGNED DEFAULT 0,
38 MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
39 MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
40 MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
41 InChanger TINYINT DEFAULT 0,
42 MediaAddressing TINYINT DEFAULT 0,
43 VolReadTime BIGINT UNSIGNED DEFAULT 0,
44 VolWriteTime BIGINT UNSIGNED DEFAULT 0,
45 EndFile INTEGER UNSIGNED DEFAULT 0,
46 EndBlock INTEGER UNSIGNED DEFAULT 0,
50 INSERT INTO Media_backup SELECT
51 MediaId, VolumeName, Slot, PoolId,
52 MediaType, FirstWritten, LastWritten,
53 LabelDate, VolJobs, VolFiles, VolBlocks,
54 VolMounts, VolBytes, VolErrors, VolWrites,
55 VolCapacityBytes, VolStatus, Recycle,
56 VolRetention, VolUseDuration, MaxVolJobs,
57 MaxVolFiles, MaxVolBytes, InChanger, MediaAddressing,
58 VolReadTime, VolWriteTime, 0, 0
65 MediaId INTEGER UNSIGNED AUTOINCREMENT,
66 VolumeName VARCHAR(128) NOT NULL,
67 Slot INTEGER DEFAULT 0,
68 PoolId INTEGER UNSIGNED REFERENCES Pool NOT NULL,
69 MediaType VARCHAR(128) NOT NULL,
70 FirstWritten DATETIME DEFAULT 0,
71 LastWritten DATETIME DEFAULT 0,
72 LabelDate DATETIME DEFAULT 0,
73 VolJobs INTEGER UNSIGNED DEFAULT 0,
74 VolFiles INTEGER UNSIGNED DEFAULT 0,
75 VolBlocks INTEGER UNSIGNED DEFAULT 0,
76 VolMounts INTEGER UNSIGNED DEFAULT 0,
77 VolBytes BIGINT UNSIGNED DEFAULT 0,
78 VolErrors INTEGER UNSIGNED DEFAULT 0,
79 VolWrites INTEGER UNSIGNED DEFAULT 0,
80 VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
81 VolStatus VARCHAR(20) NOT NULL,
82 Recycle TINYINT DEFAULT 0,
83 VolRetention BIGINT UNSIGNED DEFAULT 0,
84 VolUseDuration BIGINT UNSIGNED DEFAULT 0,
85 MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
86 MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
87 MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
88 InChanger TINYINT DEFAULT 0,
89 MediaAddressing TINYINT DEFAULT 0,
90 VolReadTime BIGINT UNSIGNED DEFAULT 0,
91 VolWriteTime BIGINT UNSIGNED DEFAULT 0,
92 EndFile INTEGER UNSIGNED DEFAULT 0,
93 EndBlock INTEGER UNSIGNED DEFAULT 0,
98 MediaId, VolumeName, Slot, PoolId,
99 MediaType, FirstWritten, LastWritten,
100 LabelDate, VolJobs, VolFiles, VolBlocks,
101 VolMounts, VolBytes, VolErrors, VolWrites,
102 VolCapacityBytes, VolStatus, Recycle,
103 VolRetention, VolUseDuration, MaxVolJobs,
104 MaxVolFiles, MaxVolBytes,
105 InChanger, MediaAddressing,
106 VolReadTime, VolWriteTime,
108 SELECT * FROM Media_backup;
110 DROP TABLE Media_backup;
114 UPDATE Filename SET Name='' WHERE Name=' ';
117 INSERT INTO Version (VersionId) VALUES (8);