 +   );
 +CREATE INDEX inx6 ON Job (Name);
 +
-+INSERT INTO Job SELECT 0 AS ReadBytes, * FROM Job_backup;
++INSERT INTO Job (JobId, Job, Name, Type, Level, ClientId, JobStatus,
++SchedTime, StartTime, EndTime, RealEndTime, JobTDate, VolSessionId,
++VolSessionTime, JobFiles, JobBytes, JobErrors, JobMissingFiles,
++PoolId, FileSetId, PriorJobId, PurgedFiles, HasBase) SELECT
++JobId, Job, Name, Type, Level, ClientId, JobStatus, SchedTime, StartTime,
++EndTime, RealEndTime, JobTDate, VolSessionId, VolSessionTime, JobFiles,
++JobBytes, JobErrors, JobMissingFiles, PoolId, FileSetId, PriorJobId,
++PurgedFiles, HasBase FROM Job_backup;
++
 +DROP TABLE Job_backup;
 +
- UPDATE Version SET VersionId=11;
- 
++UPDATE Version SET VersionId=11;
++
++COMMIT;
++
++BEGIN TRANSACTION;
++
+ CREATE TABLE JobHistory (
+    JobId INTEGER,
+    Job VARCHAR(128) NOT NULL,
+@@ -36,6 +84,7 @@
+    VolSessionTime INTEGER UNSIGNED DEFAULT 0,
+    JobFiles INTEGER UNSIGNED DEFAULT 0,
+    JobBytes BIGINT UNSIGNED DEFAULT 0,
++   ReadBytes BIGINT UNSIGNED DEFAULT 0,
+    JobErrors INTEGER UNSIGNED DEFAULT 0,
+    JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
+    PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+@@ -47,8 +96,6 @@
+    );
+ CREATE INDEX inx61 ON JobHistory (Name);
+ 
+-UPDATE Version SET VersionId=11;
+-
  COMMIT;
+ 
+ END-OF-DATA
 Index: src/cats/update_mysql_tables.in
 ===================================================================
---- src/cats/update_mysql_tables.in	(révision 8431)
-+++ src/cats/update_mysql_tables.in	(copie de travail)
-@@ -12,13 +12,16 @@
+--- src/cats/update_mysql_tables.in	(revision 8431)
++++ src/cats/update_mysql_tables.in	(working copy)
+@@ -12,16 +12,19 @@
  if $bindir/mysql $* -f <<END-OF-DATA
  USE ${db_name};
  

 END-OF-DATA
Index: src/cats/make_sqlite3_tables.in
===================================================================
--- src/cats/make_sqlite3_tables.in	(révision 8431)
+++ src/cats/make_sqlite3_tables.in	(copie de travail)
@@ -64,6 +64,7 @@
    VolSessionTime INTEGER UNSIGNED DEFAULT 0,
    JobFiles INTEGER UNSIGNED DEFAULT 0,

+ALTER TABLE BaseFiles CHANGE FileId FileId BIGINT UNSIGNED NOT NULL;
+ALTER TABLE Job ADD ReadBytes BIGINT UNSIGNED DEFAULT 0 AFTER JobBytes; 
 
 DELETE FROM Version;
 INSERT INTO Version (VersionId) VALUES (11);
 
+-- Create a table like Job for long term statistics
+CREATE TABLE JobHistory (LIKE Job);
+
 END-OF-DATA
 then
    echo "Update of Bacula MySQL tables succeeded."
Index: src/cats/make_sqlite_tables.in
===================================================================
--- src/cats/make_sqlite_tables.in	(revision 8431)
+++ src/cats/make_sqlite_tables.in	(working copy)
@@ -64,6 +64,7 @@
    VolSessionTime INTEGER UNSIGNED DEFAULT 0,
    JobFiles INTEGER UNSIGNED DEFAULT 0,
