]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/update_postgresql_tables.in
ebl Modify disk-changer to check if slot contains something before
[bacula/bacula] / bacula / src / cats / update_postgresql_tables.in
old mode 100755 (executable)
new mode 100644 (file)
index c3fe199..159e5bd
@@ -1,35 +1,22 @@
 #!/bin/sh
 #
-# Shell script to update PostgreSQL tables from version 1.34 to 1.35.5
+# Shell script to update PostgreSQL tables from version 2.0.0 to 3.0.0 or higher
 #
 echo " "
-echo "This script will update a Bacula PostgreSQL database from version 7 to 8"
-echo "Depending on the size of your database,"
-echo "this script may take several minutes to run."
+echo "This script will update a Bacula PostgreSQL database from version 10 to 11"
+echo " which is needed to convert from Bacula version 2.0.0 to 3.0.x or higher"
 echo " "
 bindir=@SQL_BINDIR@
+db_name=@db_name@
 
-if $bindir/psql $* -f - <<END-OF-DATA
-\c bacula
+if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
 
-ALTER TABLE media ADD COLUMN EndFile integer;
-UPDATE media SET EndFile=0;
-ALTER TABLE media ALTER COLUMN EndFile SET NOT NULL;
-ALTER TABLE media ADD COLUMN EndBlock integer;
-UPDATE media SET EndBlock=0;
-ALTER TABLE media ALTER COLUMN EndBlock SET NOT NULL;
+-- Create a table like Job for long term statistics
+CREATE TABLE jobstat (LIKE job);
 
-UPDATE Filename SET Name='' WHERE Name=' ';
+UPDATE version SET versionid=11;
 
-ALTER TABLE file ALTER COLUMN filenameid SET integer;
-
-DELETE FROM Version;
-INSERT INTO Version (VersionId) VALUES (8);
-
-create index file_jobid_idx on file (jobid);
-create index file_pathid_idx on file(pathid);
-create index file_filenameid_idx on file(filenameid);
-create index file_jpfid_idx on file (jobid, pathid, filenameid);
+vacuum analyse;
 
 END-OF-DATA
 then