--**************************************************************************
--     Table: dbo.Repository_History
--    Author: Ron Savage
--      Date: 09/28/2008
--
-- Description:
-- This table is used to store a historical list of configuration files and thier 
-- content along with creation / update users and dates, with a new record every
-- time a file gets inserted or updated in the Repository table.
--
-- Modification History:
-- Date        Init  Comment
-- 10/17/2008  RS    Changed content field to varbinary(MAX) rather than text to store any file.
-- 09/28/2008  RS    Created.
--**************************************************************************

if exists (select * from dbo.sysobjects where  name = 'Repository_History') drop table Repository_History;
go

create table dbo.Repository_History
   (
   history_id       integer identity Primary Key,
   config_id        integer,
   filename         varchar(100),
   created_by       varchar(40),
   created_system   varchar(40),
   create_date      datetime,
   updated_by       varchar(40),
   updated_system   varchar(40),
   last_updated     datetime,
   content          varbinary(MAX) 
   )
go

create index crh_cid    on dbo.Repository_History (config_id);
create index crh_cidupd on dbo.Repository_History (config_id, last_updated);
go
 