/*****************************************************************************
*
* Filename         - $Workfile$
*
* Author           - Michael Clark
* Last Update      - $Date$
*
* Project Name     - TAGTRAK(Oracle Database)
*
* Source Code
* Identifier       -
*
* Design Spec
* Section          -
*
* Contents         - Live Schema: bag_alert_priority table
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2007
*
*****************************************************************************/

PROMPT Creating Table 'bag_alert_priority'
CREATE TABLE bag_alert_priority
 (ALERT_TYPE CHAR(10) NOT NULL
 ,PRIORITY NUMBER(2) NOT NULL
 ,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
 );

ALTER TABLE bag_alert_priority ADD (CONSTRAINT bag_alert_priority_pk1 PRIMARY KEY (appn_row_id));
ALTER TABLE bag_alert_priority ADD (CONSTRAINT bag_alert_priority_uk1 UNIQUE (alert_type));


COMMENT ON TABLE bag_alert_priority IS 'Stores the priority for configured alerts. This will provide a configurable ordering for the MWS.';

COMMENT ON COLUMN bag_alert_priority.alert_type IS 'The alert type.';
COMMENT ON COLUMN bag_alert_priority.priority IS 'The priority of this alert type - the lower the value, the higher the priority.';
COMMENT ON COLUMN bag_alert_priority.appn_row_id IS 'Unique sequence number for this row';
COMMENT ON COLUMN bag_alert_priority.row_create_time IS 'The time the row was created';
COMMENT ON COLUMN bag_alert_priority.row_date_time IS 'The time the row was last modified';
COMMENT ON COLUMN bag_alert_priority.cuser IS 'The user who created the row';
COMMENT ON COLUMN bag_alert_priority.muser IS 'The user who last modified the row';
COMMENT ON COLUMN bag_alert_priority.mterm IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN bag_alert_priority.system_id IS 'The system identifier';
COMMENT ON COLUMN bag_alert_priority.source IS 'The process that last amended this row';
COMMENT ON COLUMN bag_alert_priority.to_be_archived IS 'Indicates that this row is to be archived or has been archived';