/*****************************************************************************
*
* Filename         - $Workfile:   fs_events.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: fs_events table and associated items
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   fs_events.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/fs_events.svl  $
 * 
 *    Rev 1.3   06 Jun 2000 09:53:22   tagtrak
 *  
 * 
 *    Rev 1.2.1.2   10 Jun 1999 14:51:48   tagtrak
 * OR:
 * CR: 14043
 * REV:
 * Changed Archive and Backup so that the database
 * can be accessed during the eraseLive function.
 * 
 * Neil Bishop.
 * 
 *    Rev 1.2   02 Apr 1998 19:43:08   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial Issue
 * See label for concession
 * 
 *    Rev 1.1   26 Feb 1998 11:07:54   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial core product version
 * 
 *    Rev 1.0   22 Oct 1997 11:07:50   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial check-in
*
****************************************************************************/

PROMPT Creating table FS_EVENTS

create table FS_EVENTS (
   FLIGHT_ID                     number(10) NOT NULL,
   DELTA_CHK_BAG                 number(6) default 0 NOT NULL,
   DELTA_LDD_BAG                 number(6) default 0 NOT NULL,
   DELTA_CHK_PAX                 number(6) default 0 NOT NULL,
   DELTA_BDD_PAX                 number(6) default 0 NOT NULL,
   DELTA_REJ_BAG                 number(6) default 0 NOT NULL,
   DELTA_SHT_PAX                 number(6) default 0 NOT NULL,
   DELTA_SHT_BAG                 number(6) default 0 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 fs_events add ( constraint fs_events_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table fs_events add ( constraint fs_events_fk_flight foreign key (flight_id) references flight (flight_id) on delete cascade);

create index FS_EVENTS_IDX1 on FS_EVENTS(FLIGHT_ID) tablespace &1._indexes;

COMMENT ON TABLE FS_EVENTS IS 'This table contains FLIGHT_STATUS_EVENTS';

COMMENT ON COLUMN FS_EVENTS.DELTA_BDD_PAX IS  'Boarded passengers';
COMMENT ON COLUMN FS_EVENTS.DELTA_CHK_BAG IS  'Checked-in bag';
COMMENT ON COLUMN FS_EVENTS.DELTA_CHK_PAX IS  'Checked in passengers';
COMMENT ON COLUMN FS_EVENTS.DELTA_LDD_BAG IS  'Loaded bag';
COMMENT ON COLUMN FS_EVENTS.DELTA_REJ_BAG IS  'Rejected passengers';
COMMENT ON COLUMN FS_EVENTS.DELTA_SHT_BAG IS  'Short bags';
COMMENT ON COLUMN FS_EVENTS.DELTA_SHT_PAX IS  'Short passengers';
COMMENT ON COLUMN FS_EVENTS.FLIGHT_ID IS  'Flight identifier';
COMMENT ON COLUMN FS_EVENTS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN FS_EVENTS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN FS_EVENTS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN FS_EVENTS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN FS_EVENTS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN FS_EVENTS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN FS_EVENTS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN FS_EVENTS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN FS_EVENTS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
