/*****************************************************************************
*
* Filename         - $Workfile:   bpm_status_trace.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: bpm_status_trace table and associated items
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   bpm_status_trace.sql  $  $Revision:   1.4  $
*
* 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/bpm_status_trace.svl  $
 * 
 *    Rev 1.4   21 Jun 2001 14:46:50   tagtrak
 * OR:
 * CR:
 * Re-baseline version 4.0.0 to include patches.
 * 
 *    Rev 1.3   02 Apr 1998 19:42:34   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial Issue
 * See label for concession
 * 
 *    Rev 1.2   26 Feb 1998 11:07:30   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial core product version
 * 
 *    Rev 1.1   15 Jan 1998 13:59:06   tagtrak
 * OR: OR11101, TN13, TN15
 * CR:
 * REV:
 * Phase 2C to Phase 3 upgrade, plus code review actions and resolving some echnical issues.
 * 
 * 
 *    Rev 1.0   22 Oct 1997 11:07:28   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial check-in
*
****************************************************************************/

PROMPT Creating table BPM_STATUS_TRACE;

create table BPM_STATUS_TRACE (
   PROCESS_NAME                  char(20) NOT NULL,
   UNIT_NAME                     char(10) NOT NULL,
   DCSID                         char(7) NOT NULL,
   SUBUNIT_NAME                  CHAR(4) NOT NULL,
   NEW_BPM_STATUS                char(1) NOT NULL,
   TRACE_TIME                    date NOT NULL,
   USER_ID                       number(10) 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 bpm_status_trace add ( constraint bpm_status_trace_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table bpm_status_trace add constraint bpm_status_trace_fk_system_cfg foreign key (process_name, unit_name, subunit_name, dcsid) references system_cfg (process_name, unit_name, subunit_name, dcsid);

CREATE INDEX bpm_status_trace_sk1 ON bpm_status_trace(process_name, unit_name, subunit_name, dcsid) TABLESPACE &1._indexes;

COMMENT ON TABLE BPM_STATUS_TRACE IS 'This table contains BPM trace information';

COMMENT ON COLUMN BPM_STATUS_TRACE.DCSID IS  'Part of the unique DCS identifier';
COMMENT ON COLUMN BPM_STATUS_TRACE.NEW_BPM_STATUS IS  'The new BPM status ';
COMMENT ON COLUMN BPM_STATUS_TRACE.PROCESS_NAME IS  'Indicator of how this entry was created or last updated ';
COMMENT ON COLUMN BPM_STATUS_TRACE.SUBUNIT_NAME IS  'Address stamp of the DCS which sent the BSM';
COMMENT ON COLUMN BPM_STATUS_TRACE.TRACE_TIME IS  'The time the entry was created';
COMMENT ON COLUMN BPM_STATUS_TRACE.UNIT_NAME IS  'The UNIT_NAME from the SYSTEM_CFG table for the DCS that this entry was received from.';
COMMENT ON COLUMN BPM_STATUS_TRACE.USER_ID IS  'The user identifier ';
COMMENT ON COLUMN BPM_STATUS_TRACE.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN BPM_STATUS_TRACE.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN BPM_STATUS_TRACE.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN BPM_STATUS_TRACE.CUSER IS 'The user who created the row';
COMMENT ON COLUMN BPM_STATUS_TRACE.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN BPM_STATUS_TRACE.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN BPM_STATUS_TRACE.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN BPM_STATUS_TRACE.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN BPM_STATUS_TRACE.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
