Bacula-users

[Bacula-users] move bacula 2.4.3 psql database to bacula 5.0.0

2013-10-14 03:43:42
Subject: [Bacula-users] move bacula 2.4.3 psql database to bacula 5.0.0
From: kkuznetsov <bacula-forum AT backupcentral DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 14 Oct 2013 00:40:50 -0700
Pretty close, but not. Found this /etc/alternatives/update_bacula_tables which 
then launches /usr/libexec/bacula/update_postgresql_tables

here is a code:

#!/bin/sh
#
# Shell script to update PostgreSQL tables from version 11 to 12
#
echo " "
echo "This script will update a Bacula PostgreSQL database from version 11 to 
12"
echo " which is needed to convert from Bacula Enterprise 2.6 to 4.0 or "
echo " Standard version 3.0 to 5.0"
echo " "

bindir=/usr/bin
export PATH="$bindir:$PATH"
db_name=bacula

if psql -f - -d ${db_name} $* <<END-OF-DATA
BEGIN; -- Necessary for Bacula core
ALTER TABLE JobMedia DROP Copy ;
ALTER TABLE Job ADD COLUMN HasCache smallint default 0;
ALTER TABLE Job ADD COLUMN Reviewed smallint default 0;
ALTER TABLE Job ADD COLUMN Comment text;
ALTER TABLE JobHisto ADD COLUMN HasCache smallint default 0;
ALTER TABLE JobHisto ADD COLUMN Reviewed smallint default 0;
ALTER TABLE JobHisto ADD COLUMN Comment text;
UPDATE Version SET VersionId=12;
COMMIT;

BEGIN; -- Can conflict with previous Bweb installation
ALTER TABLE Status ADD COLUMN Severity int;
UPDATE Status SET Severity = 15;
UPDATE Status SET Severity = 100 where JobStatus = 'f';
UPDATE Status SET Severity = 90 where JobStatus = 'A';
UPDATE Status SET Severity = 10 where JobStatus = 'T';
UPDATE Status SET Severity = 20 where JobStatus = 'e';
UPDATE Status SET Severity = 25 where JobStatus = 'E';
COMMIT;

BEGIN; -- Can already exists if using 3.1.x release
CREATE TABLE PathHierarchy
(
     PathId integer NOT NULL,
     PPathId integer NOT NULL,
     CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId)
);

CREATE INDEX pathhierarchy_ppathid
          ON PathHierarchy (PPathId);

CREATE TABLE PathVisibility
(
      PathId integer NOT NULL,
      JobId integer NOT NULL,
      Size int8 DEFAULT 0,
      Files int4 DEFAULT 0,
      CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
);

CREATE INDEX pathvisibility_jobid
          ON PathVisibility (JobId);

COMMIT;

CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId );

-- Remove bad PostgreSQL index
DROP INDEX file_fp_idx;

-- Create the good one
-- If you want to create this index during production, you can use
-- CREATE INDEX CONCURRENTLY file_jpf_idx ON File (JobId, PathId, FilenameId)
-- to make it without locks (require PostgreSQL 8.2 version)

CREATE INDEX file_jpfid_idx on File (JobId, PathId, FilenameId);

ANALYSE;

END-OF-DATA
then
   echo "Update of Bacula PostgreSQL tables succeeded."
else
   echo "Update of Bacula PostgreSQL tables failed."
fi
exit 0


Nothing about column "readbytes". Anyway i attempted to make this step with 
updating tables and the problem is still the same...[/b]

+----------------------------------------------------------------------
|This was sent by kkuznetsov AT web.1tv DOT ru via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users