]> 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 8475592..159e5bd
@@ -1,46 +1,22 @@
 #!/bin/sh
 #
-# Shell script to update PostgreSQL tables from version 1.38 to 1.39
+# 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 9 to 9"
-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 - -d bacula $* <<END-OF-DATA
+if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
 
-ALTER TABLE media ADD COLUMN DeviceId integer;
-UPDATE media SET DeviceId=0;
-ALTER TABLE media ADD COLUMN MediaTypeId integer;
-UPDATE media SET MediaTypeId=0;
-ALTER TABLE media ADD COLUMN LocationId integer;
-UPDATE media SET LocationId=0;
+-- Create a table like Job for long term statistics
+CREATE TABLE jobstat (LIKE job);
 
+UPDATE version SET versionid=11;
 
-CREATE TABLE MAC (
-    JobId            serial      not null,
-    OriginalJobId     serial     not null,
-    JobType          char(1)     not null,
-    JobLevel         char(1)     not null,
-    SchedTime        timestamp   without time zone not null,
-    StartTime        timestamp   without time zone,
-    EndTime          timestamp   without time zone,
-    JobTDate         bigint      not null,
-    primary key (JobId)
-);
-
-CREATE TABLE Location (
-   LocationId SERIAL,
-   Location TEXT NOT NULL,
-   PRIMARY KEY(LocationId)
-   );
-
-
-INSERT INTO version (versionId) VALUES (9);
-
-vacuum;
+vacuum analyse;
 
 END-OF-DATA
 then