3 # Shell script to fix PostgreSQL tables in version 8
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."
11 # Set the following to the path to psql.
12 bindir=****EDIT-ME to be the path to psql****
14 if $bindir/psql $* -f - <<END-OF-DATA
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;
31 echo "Update of Bacula PostgreSQL tables succeeded."
33 echo "Update of Bacula PostgreSQL tables failed."