/*****************************************************************************
*
* Filename              - handler_trace.sql
*
* Project Name          - UltraTrak Database
*
* Source Code Identifier - FAS/URBRS/TN/10134
*
* Description           - Table creation script for HANDLER_TRACE. Stores details of user
*                         login/logouts. 
*
* Language              - Oracle PL/SQL
*
* File History          - For the development history run the Show History report in PVCS
*
* Copyright Ultra Electronics Airport Systems, 2003
*
*****************************************************************************/

PROMPT Creating table HANDLER_TRACE

create table handler_trace (
   seq_no                        number not null,
   user_id                       number(10) not null,
   kit_id                        number(10) not null,
   flight_id                     number(10) not null,
   login_time                    varchar2(5),
   logout_time                   varchar2(5),
   location_code                 char(6),
   last_update                   date,
   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 handler_trace add ( constraint handler_trace_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table handler_trace add ( constraint handler_trace_uk1 unique (seq_no) using index tablespace &1._indexes );

COMMENT ON TABLE HANDLER_TRACE IS 'This table contains trace logs for which users are operating on each flight';

COMMENT ON COLUMN HANDLER_TRACE.FLIGHT_ID IS  'Flight identifier';
COMMENT ON COLUMN HANDLER_TRACE.KIT_ID IS  'Kit identifier';
COMMENT ON COLUMN HANDLER_TRACE.LAST_UPDATE IS  'Last update time';
COMMENT ON COLUMN HANDLER_TRACE.LOCATION_CODE IS  'Location code';
COMMENT ON COLUMN HANDLER_TRACE.LOGIN_TIME IS  'Login time';
COMMENT ON COLUMN HANDLER_TRACE.LOGOUT_TIME IS  'Logout time';
COMMENT ON COLUMN HANDLER_TRACE.SEQ_NO IS  'Unique identifier';
COMMENT ON COLUMN HANDLER_TRACE.USER_ID IS  'User identifier';
COMMENT ON COLUMN HANDLER_TRACE.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN HANDLER_TRACE.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN HANDLER_TRACE.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN HANDLER_TRACE.CUSER IS 'The user who created the row';
COMMENT ON COLUMN HANDLER_TRACE.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN HANDLER_TRACE.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN HANDLER_TRACE.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN HANDLER_TRACE.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN HANDLER_TRACE.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
