/*****************************************************************************
*
* Filename         - $Workfile:   ARCHIVE_CONFIG.sql  $
*
* Author           - Dave Banks
*
* Project Name     - UltraTrak Core 
*
* Source Code
* Identifier       - Database (Master Standby) 
*
* Design Spec
* Section          - 
*
* Contents         - Database script to create table ARCHIVE_CONFIG
*
* Language         - Oracle SQL script      
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2006
*
*****************************************************************************/

CREATE TABLE ARCHIVE_CONFIG
(   ROW_CREATE_TIME DATE,
    ROW_DATE_TIME DATE,
    CUSER VARCHAR2(30),
    MUSER VARCHAR2(30),
    MTERM VARCHAR2(64),
    SOURCE VARCHAR2(8),
    TO_BE_ARCHIVED VARCHAR2(1),
    APPN_ROW_ID NUMBER(18,0) NOT NULL ENABLE,
    SYSTEM_ID NUMBER(4,0) DEFAULT 0 NOT NULL ENABLE,
    USERNAME VARCHAR2(64) NOT NULL ENABLE,
    PASSWORD VARCHAR2(64) NOT NULL ENABLE,
    COMPRESSION VARCHAR2(1) DEFAULT 'Y' NOT NULL ENABLE,
    DEST_PATH VARCHAR2(256) NOT NULL ENABLE,
    MIRROR_PATH VARCHAR2(256),
    CHUNK_SIZE NUMBER(4,0) DEFAULT 0,
    RETRIES NUMBER(2,0) NOT NULL ENABLE,
    SLEEP NUMBER(3,2) NOT NULL ENABLE,
    DEBUG_MODE VARCHAR2(1) DEFAULT 'N',
    STATUS VARCHAR2(2000)
)
 STORAGE
 (
   INITIAL 20K
   NEXT 20K
   PCTINCREASE 0
 ) TABLESPACE APPN_GENERAL_TABLES
/

ALTER TABLE ARCHIVE_CONFIG
 ADD (CONSTRAINT ARCHIVE_CONFIG_PK PRIMARY KEY
  (APPN_ROW_ID)
 USING INDEX
 PCTFREE 5
 STORAGE
 (
   INITIAL 20K
   NEXT 20K
   PCTINCREASE 0
 ) TABLESPACE APPN_GENERAL_IDXS)
/

ALTER TABLE ARCHIVE_CONFIG
 ADD (CONSTRAINT ARCHIVE_CONFIG_UK1 UNIQUE
  (USERNAME
  ,SYSTEM_ID)
 USING INDEX
 PCTFREE 5
 STORAGE
 (
   INITIAL 20K
   NEXT 20K
   PCTINCREASE 0
 ) TABLESPACE APPN_GENERAL_IDXS)
/

ALTER TABLE ARCHIVE_CONFIG
 ADD (CONSTRAINT ARCHIVE_CONFIG_CHUNK_SIZE CHECK (CHUNK_SIZE >= 0))
/

ALTER TABLE ARCHIVE_CONFIG
 ADD (CONSTRAINT ARCHIVE_CONFIG_SLEEP CHECK (SLEEP >= 0))
/

ALTER TABLE ARCHIVE_CONFIG
 ADD (CONSTRAINT ARCHIVE_CONFIG_DEBUG_MODE CHECK (DEBUG_MODE IN ('Y','N')))
/

ALTER TABLE ARCHIVE_CONFIG
 ADD (CONSTRAINT ARCHIVE_CONFIG_COMPRESSION CHECK (COMPRESSION IN ('Y','N')))
/

ALTER TABLE ARCHIVE_CONFIG
 ADD (CONSTRAINT ARCHIVE_CONFIG_RETRIES CHECK (RETRIES >= 0))
/

