]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/update_postgresql_tables.in
5be47510e7b7356c3b2d5621342cd8e1a206e8a4
[bacula/bacula] / bacula / src / cats / update_postgresql_tables.in
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=@SQL_BINDIR@
11
12 if $bindir/psql $* -f - <<END-OF-DATA
13 \c bacula
14
15 ALTER TABLE media ADD COLUMN labeltype integer;
16 UPDATE media SET labeltype=0;
17 ALTER TABLE media ALTER COLUMN labeltype SET NOT NULL;
18 ALTER TABLE pool ADD COLUMN labeltype integer;
19 UPDATE pool set labeltype=0;
20 ALTER TABLE pool ALTER COLUMN labeltype SET NOT NULL;
21
22 ALTER TABLE media ADD COLUMN volparts integer;
23 UPDATE media SET volparts=0;
24 ALTER TABLE media ALTER COLUMN volparts SET NOT NULL;
25
26 vacuum;
27
28 END-OF-DATA
29 then
30    echo "Update of Bacula PostgreSQL tables succeeded."
31 else
32    echo "Update of Bacula PostgreSQL tables failed."
33 fi
34 exit 0