]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/update_postgresql_tables.in
Change old get_Jobxxx to getJobxxx
[bacula/bacula] / bacula / src / cats / update_postgresql_tables.in
index 159e5bdaa603573f2920bf57afda4b69746d4966..87381c29f26cc4cd42466460b1c7f05c5b61134c 100644 (file)
@@ -11,13 +11,28 @@ db_name=@db_name@
 
 if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
 
+-- The alter table operation can be faster with a big maintenance_work_mem
+-- Uncomment and adapt this value to your environment
+-- SET maintenance_work_mem = '1GB';
+
+BEGIN;
+ALTER TABLE file ALTER fileid TYPE bigint ;
+ALTER TABLE basefiles ALTER fileid TYPE bigint;
+ALTER TABLE job ADD COLUMN readbytes bigint default 0;
+ALTER TABLE media ADD COLUMN ActionOnPurge smallint default 0;
+ALTER TABLE pool ADD COLUMN ActionOnPurge smallint default 0;
+
 -- Create a table like Job for long term statistics
-CREATE TABLE jobstat (LIKE job);
+CREATE TABLE JobHisto (LIKE Job);
+CREATE INDEX jobhisto_idx ON JobHisto ( starttime );
 
-UPDATE version SET versionid=11;
+UPDATE Version SET VersionId=11;
+COMMIT;
 
-vacuum analyse;
+-- If you have already this table, you can remove it with:
+-- DROP TABLE JobHistory;
 
+-- vacuum analyse;
 END-OF-DATA
 then
    echo "Update of Bacula PostgreSQL tables succeeded."