/*****************************************************************************
*
* Filename         - $Workfile:   mail_global.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - See revision history below.
* Last Update      - See revision history below.
*
* Project Name     - TAGTRAK(Oracle Database)
*
* Source Code
* Identifier       - 0/3/300/8010/112
*
* Design Spec
* Section          - 
*
* Contents         - Live Schema: mail_global table and associated items
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   mail_global.sql  $  $Revision:   1.3  $
*
* Revision History
*
* Note that user tagtrak is many users. For these users the user
* name is entered as the last line in the change description.
*
* $Log:   /pvcsarch/db_ora/db/source/live/tables/mail_global.svl  $
 * 
 *    Rev 1.3   21 Jun 2001 14:48:00   tagtrak
 * OR:
 * CR:
 * Re-baseline version 4.0.0 to include patches.
 * 
 *    Rev 1.2   02 Apr 1998 19:43:26   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial Issue
 * See label for concession
 * 
 *    Rev 1.1   26 Feb 1998 11:08:08   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial core product version
 * 
 *    Rev 1.0   22 Oct 1997 11:08:04   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial check-in
*
****************************************************************************/

PROMPT Creating table MAIL_GLOBAL

create table MAIL_GLOBAL (
   GLOBAL_MSG_ID                 number(10) NOT NULL,
   MSG_ADDRESS                   char(30) NOT NULL,
   MSG_TYPE                      char(6) NOT NULL,
   MSG_TEXT                      varchar2(100) NOT NULL,
   MSG_TIME                      date NOT NULL,
   ADDRESSEE_COUNT               number(6) 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 mail_global add ( constraint mail_global_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table MAIL_GLOBAL add ( constraint mail_global_uk1 unique (GLOBAL_MSG_ID) using index tablespace &1._indexes);

create index MAIL_GLOBAL_SK1 on MAIL_GLOBAL(MSG_TYPE) tablespace &1._indexes;
 
create index MAIL_GLOBAL_SK2 on MAIL_GLOBAL(MSG_ADDRESS) tablespace &1._indexes;
 
create index MAIL_GLOBAL_SK3 on MAIL_GLOBAL(MSG_TIME) tablespace &1._indexes;

COMMENT ON TABLE MAIL_GLOBAL IS 'This table contains global mail messages';

COMMENT ON COLUMN MAIL_GLOBAL.ADDRESSEE_COUNT IS  'Addressee count';
COMMENT ON COLUMN MAIL_GLOBAL.GLOBAL_MSG_ID IS  'Global message identifier';
COMMENT ON COLUMN MAIL_GLOBAL.MSG_ADDRESS IS  'Message address';
COMMENT ON COLUMN MAIL_GLOBAL.MSG_TEXT IS  'Message text';
COMMENT ON COLUMN MAIL_GLOBAL.MSG_TIME IS  'Message time';
COMMENT ON COLUMN MAIL_GLOBAL.MSG_TYPE IS  'Message type';
COMMENT ON COLUMN MAIL_GLOBAL.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN MAIL_GLOBAL.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN MAIL_GLOBAL.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN MAIL_GLOBAL.CUSER IS 'The user who created the row';
COMMENT ON COLUMN MAIL_GLOBAL.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN MAIL_GLOBAL.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN MAIL_GLOBAL.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN MAIL_GLOBAL.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN MAIL_GLOBAL.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
