--
-- We drop and recreate the stats table which was not used yet.
--
DROP TABLE DeviceStats;
CREATE TABLE DeviceStats (
   DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device,
   SampleTime DATETIME NOT NULL,
   ReadTime BIGINT UNSIGNED DEFAULT 0,
   WriteTime BIGINT UNSIGNED DEFAULT 0,
   ReadBytes BIGINT UNSIGNED DEFAULT 0,
   WriteBytes BIGINT UNSIGNED DEFAULT 0,
   SpoolSize BIGINT UNSIGNED DEFAULT 0,
   NumWaiting INTEGER DEFAULT 0,
   NumWriters INTEGER DEFAULT 0,
   MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media,
   VolCatBytes BIGINT UNSIGNED DEFAULT 0,
   VolCatFiles BIGINT UNSIGNED DEFAULT 0,
   VolCatBlocks BIGINT UNSIGNED DEFAULT 0
);

--
-- We drop and recreate the stats table which was not used yet.
--
DROP TABLE JobStats;
CREATE TABLE JobStats (
   DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device,
   SampleTime DATETIME NOT NULL,
   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
   JobFiles INTEGER UNSIGNED DEFAULT 0,
   JobBytes BIGINT UNSIGNED DEFAULT 0
);

CREATE TABLE TapeAlerts (
   DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device,
   SampleTime DATETIME NOT NULL,
   AlertFlags BIGINT UNSIGNED DEFAULT 0
);

DROP TABLE CDImages;

UPDATE Version SET VersionId = 2003;
