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

PROMPT Creating Table 'FSU_TABS'
CREATE TABLE FSU_TABS
 (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) NOT NULL
 ,SYSTEM_ID NUMBER(4) DEFAULT 0 NOT NULL
 ,TABLE_NAME VARCHAR2(61) NOT NULL
 ,CATEGORY NUMBER(1) NOT NULL
 ,UPDATE_SEQ NUMBER(3)
 ,TIMESTAMP DATE NOT NULL
 ,MESSAGE_NOTIFICATION VARCHAR2(1)
 )
 PCTUSED 90
 PCTFREE 5
 STORAGE
 (
   INITIAL 20K
   NEXT 20K
   PCTINCREASE 0
 ) TABLESPACE APPN_GENERAL_TABLES
/

PROMPT Creating Primary Key on 'FSU_TABS'
ALTER TABLE FSU_TABS
 ADD (CONSTRAINT FSU_TABS_PK PRIMARY KEY
  (APPN_ROW_ID))
/

PROMPT Creating Unique Key on 'FSU_TABS'
ALTER TABLE FSU_TABS
 ADD (CONSTRAINT FSU_TABS_UK1 UNIQUE
  (TABLE_NAME
  ,SYSTEM_ID))
/

PROMPT Creating Check Constraint on 'FSU_TABS'
ALTER TABLE FSU_TABS
 ADD (CONSTRAINT FSU_TABS_UPD_SEQ CHECK (UPDATE_SEQ >= 0))
/

PROMPT Creating Check Constraint on 'FSU_TABS'
ALTER TABLE FSU_TABS
 ADD (CONSTRAINT FSU_TABS_CATEGORY CHECK (CATEGORY >= 1 AND CATEGORY <= 6))
/

