]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/cats/make_postgresql_tables.in
ebl Add '*' when volume is online when displaying volume list in restore.
[bacula/bacula] / bacula / src / cats / make_postgresql_tables.in
index 051a17588ca14220366c24488027879fa6fd0171..bd136c6a0b4225622852ca5e7ccf1c125600bfd1 100644 (file)
@@ -15,7 +15,7 @@ CREATE TABLE filename
 );
 
 ALTER TABLE filename ALTER COLUMN name SET STATISTICS 1000;
-CREATE INDEX filename_name_idx on filename (name);
+CREATE UNIQUE INDEX filename_name_idx on filename (name);
 
 CREATE TABLE path
 (
@@ -25,11 +25,11 @@ CREATE TABLE path
 );
 
 ALTER TABLE path ALTER COLUMN path SET STATISTICS 1000;
-CREATE INDEX path_name_idx on path (path);
+CREATE UNIQUE INDEX path_name_idx on path (path);
 
 CREATE TABLE file
 (
-    fileid           serial      not null,
+    fileid           bigserial   not null,
     fileindex        integer     not null  default 0,
     jobid            integer     not null,
     pathid           integer     not null,
@@ -74,6 +74,7 @@ CREATE TABLE job
     volsessiontime    integer    default 0,
     jobfiles         integer     default 0,
     jobbytes         bigint      default 0,
+    readbytes        bigint      default 0,
     joberrors        integer     default 0,
     jobmissingfiles   integer    default 0,
     poolid           integer     default 0,
@@ -87,7 +88,9 @@ CREATE TABLE job
 CREATE INDEX job_name_idx on job (name);
 
 -- Create a table like Job for long term statistics 
-CREATE TABLE JobHistory (LIKE Job);
+CREATE TABLE JobHisto (LIKE Job);
+CREATE INDEX jobhisto_idx ON jobhisto ( starttime );
+
 
 CREATE TABLE Location (
    LocationId        serial      not null,
@@ -154,6 +157,7 @@ CREATE TABLE media
              'Error','Busy','Used','Cleaning','Scratch')),
     enabled          smallint    default 1,
     recycle          smallint    default 0,
+    ActionOnPurge     smallint    default 0,
     volretention      bigint     default 0,
     voluseduration    bigint     default 0,
     maxvoljobs       integer     default 0,
@@ -229,6 +233,7 @@ CREATE TABLE pool
     maxvolbytes       bigint     default 0,
     autoprune        smallint    default 0,
     recycle          smallint    default 0,
+    ActionOnPurge     smallint    default 0,
     pooltype         text                          
       check (pooltype in ('Backup','Copy','Cloned','Archive','Migration','Scratch')),
     labeltype        integer     default 0,
@@ -300,7 +305,7 @@ CREATE TABLE basefiles
 (
     baseid           serial                not null,
     jobid            integer               not null,
-    fileid           integer               not null,
+    fileid           bigint                not null,
     fileindex        integer                       ,
     basejobid        integer                       ,
     primary key (baseid)
@@ -377,7 +382,7 @@ INSERT INTO Status (JobStatus,JobStatusLong) VALUES
 INSERT INTO Status (JobStatus,JobStatusLong) VALUES
    ('i', 'Doing batch insert file records');
 
-INSERT INTO Version (VersionId) VALUES (10);
+INSERT INTO Version (VersionId) VALUES (11);
 
 -- Make sure we have appropriate permissions