]> git.sur5r.net Git - bacula/bacula/blob - bacula/updatedb/update_postgresql_tables_7_to_8
Update database scripts to include CDImages table for bimagemgr.
[bacula/bacula] / bacula / updatedb / update_postgresql_tables_7_to_8
1 #!/bin/sh
2 #
3 # Shell script to update PostgreSQL tables from version 1.34 to 1.35.5
4 #
5 echo " "
6 echo "This script will update a Bacula PostgreSQL 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."
9 echo " "
10 bindir=/home/kern/bacula/depkgs/sqlite
11
12 if $bindir/psql $* -f - <<END-OF-DATA
13 \c bacula
14
15 ALTER TABLE Media ADD COLUMN EndFile integer not null default 0;
16 ALTER TABLE Media ADD COLUMN EndBlock integer not null default 0;
17
18 UPDATE Filename SET Name='' WHERE Name=' ';
19
20 DELETE FROM Version;
21 INSERT INTO Version (VersionId) VALUES (8);
22
23 create table CDImages 
24 (
25    MediaId integer not null,
26    LastBurn timestamp without time zone not null,
27    primary key (MediaId)
28 );
29
30 END-OF-DATA
31 then
32    echo "Update of Bacula PostgreSQL tables succeeded."
33 else
34    echo "Update of Bacula PostgreSQL tables failed."
35 fi
36 exit 0