]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/fix_postgresql_tables
ebl Implement project 2, about new restore menu
[bacula/bacula] / bacula / src / cats / fix_postgresql_tables
1 #!/bin/sh
2 #
3 # Shell script to fix PostgreSQL tables in version 8
4 #
5 echo " "
6 echo "This script will fix a Bacula PostgreSQL database version 8"
7 echo "Depending on the size of your database,"
8 echo "this script may take several minutes to run."
9 echo " "
10 #
11 # Set the following to the path to psql.
12 bindir=****EDIT-ME to be the path to psql****
13
14 if $bindir/psql $* -f - <<END-OF-DATA
15 \c bacula
16
17 begin;
18
19 alter table media rename column endblock to endblock_old;
20 alter table media add column endblock bigint;
21 update media set endblock = endblock_old;
22 alter table media alter column endblock set not null;
23 alter table media drop column endblock_old;
24
25 commit;
26
27 vacuum;
28
29 END-OF-DATA
30 then
31    echo "Update of Bacula PostgreSQL tables succeeded."
32 else
33    echo "Update of Bacula PostgreSQL tables failed."
34 fi
35 exit 0