3 # Shell script to update PostgreSQL tables from version 1.38 to 1.39
6 echo "This script will update a Bacula PostgreSQL database from version 9 to 9"
7 echo "Depending on the size of your database,"
8 echo "this script may take several minutes to run."
12 if $bindir/psql -f - -d bacula $* <<END-OF-DATA
14 ALTER TABLE media ADD COLUMN DeviceId integer;
15 UPDATE media SET DeviceId=0;
16 ALTER TABLE media ADD COLUMN MediaTypeId integer;
17 UPDATE media SET MediaTypeId=0;
18 ALTER TABLE media ADD COLUMN LocationId integer;
19 UPDATE media SET LocationId=0;
23 JobId serial not null,
24 OriginalJobId serial not null,
25 JobType char(1) not null,
26 JobLevel char(1) not null,
27 SchedTime timestamp without time zone not null,
28 StartTime timestamp without time zone,
29 EndTime timestamp without time zone,
30 JobTDate bigint not null,
34 CREATE TABLE Location (
36 Location TEXT NOT NULL,
37 PRIMARY KEY(LocationId)
41 INSERT INTO version (versionId) VALUES (9);
47 echo "Update of Bacula PostgreSQL tables succeeded."
49 echo "Update of Bacula PostgreSQL tables failed."