1BEGIN; -- Necessary for Bacula core
2
3ALTER TABLE JobMedia DROP Copy ;
4ALTER TABLE Job ADD COLUMN HasCache smallint default 0;
5ALTER TABLE Job ADD COLUMN Reviewed smallint default 0;
6ALTER TABLE Job ADD COLUMN Comment text;
7ALTER TABLE JobHisto ADD COLUMN HasCache smallint default 0;
8ALTER TABLE JobHisto ADD COLUMN Reviewed smallint default 0;
9ALTER TABLE JobHisto ADD COLUMN Comment text;
10UPDATE Version SET VersionId=12;
11COMMIT;
12
13BEGIN; -- Can conflict with previous Bweb installation
14ALTER TABLE Status ADD COLUMN Severity int;
15UPDATE Status SET Severity = 15;
16UPDATE Status SET Severity = 100 where JobStatus = 'f';
17UPDATE Status SET Severity = 90 where JobStatus = 'A';
18UPDATE Status SET Severity = 10 where JobStatus = 'T';
19UPDATE Status SET Severity = 20 where JobStatus = 'e';
20UPDATE Status SET Severity = 25 where JobStatus = 'E';
21COMMIT;
22
23BEGIN; -- Can already exists if using 3.1.x release
24CREATE TABLE PathHierarchy
25(
26     PathId integer NOT NULL,
27     PPathId integer NOT NULL,
28     CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId)
29);
30
31CREATE INDEX pathhierarchy_ppathid
32	  ON PathHierarchy (PPathId);
33
34CREATE TABLE PathVisibility
35(
36      PathId integer NOT NULL,
37      JobId integer NOT NULL,
38      Size int8 DEFAULT 0,
39      Files int4 DEFAULT 0,
40      CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
41);
42
43CREATE INDEX pathvisibility_jobid
44	  ON PathVisibility (JobId);
45
46COMMIT;
47
48CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId );
49
50-- suppress output for index modification
51SET client_min_messages TO 'fatal';
52
53-- Remove bad PostgreSQL index
54DROP INDEX file_fp_idx;
55
56-- Create the good one
57-- If you want to create this index during production, you can use
58-- CREATE INDEX CONCURRENTLY file_jpf_idx ON File (JobId, PathId, FilenameId)
59-- to make it without locks (require PostgreSQL 8.2 version)
60
61CREATE INDEX file_jpfid_idx on File (JobId, PathId, FilenameId);
62
63-- restore output
64SET client_min_messages TO DEFAULT;
65
66ANALYSE;
67