/*****************************************************************************
*
* Filename         - $Workfile:   onward_flight.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: onward_flight  table and associated items
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1998
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   onward_flight.sql  $  $Revision:   1.2  $
*
* 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/onward_flight.svl  $
* 
*    Rev 1.2   06 Jun 2000 09:53:26   tagtrak
*  
* 
*    Rev 1.1.1.2   22 Jun 1999 15:50:22   tagtrak
* OR:
* CR: 14043
* REV:
* Change to Archive and Backup so that when the eraseLive function is
* called, it deletes the child records first, parent records last, so
* not to take out any table locks.
* 
* Neil Bishop.
* 
*    Rev 1.1   26 Feb 1999 08:57:44   tagtrak
*  
 *
 * 
*
****************************************************************************/

PROMPT Creating table ONWARD_FLIGHT

create table onward_flight  (
   pax_id                        number(10) not null,
   no                            char(8) not null,
   odate                         char(5) not null,
   dest                          char(3) not null,
   dest_order                    number(2) not null,
   class                         char(1),
   norm_fno                      char(8),
   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 onward_flight add ( constraint onward_flight_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table onward_flight add ( constraint onward_flight_fk_pax foreign key (pax_id) references pax (pax_id) on delete cascade);

create index onward_flight_sk1 on onward_flight(pax_id) tablespace &1._indexes;

COMMENT ON TABLE ONWARD_FLIGHT IS 'This table contains details of onward flights for passengers ';

COMMENT ON COLUMN ONWARD_FLIGHT.CLASS IS  'Passenger class';
COMMENT ON COLUMN ONWARD_FLIGHT.DEST IS  'Destination';
COMMENT ON COLUMN ONWARD_FLIGHT.DEST_ORDER IS  'Order of the passenger destination';
COMMENT ON COLUMN ONWARD_FLIGHT.NO IS  'Flight number';
COMMENT ON COLUMN ONWARD_FLIGHT.NORM_FNO IS  'Normalised flight number';
COMMENT ON COLUMN ONWARD_FLIGHT.ODATE IS  'Flight date';
COMMENT ON COLUMN ONWARD_FLIGHT.PAX_ID IS  'Passenger identifer';
COMMENT ON COLUMN ONWARD_FLIGHT.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN ONWARD_FLIGHT.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN ONWARD_FLIGHT.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN ONWARD_FLIGHT.CUSER IS 'The user who created the row';
COMMENT ON COLUMN ONWARD_FLIGHT.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN ONWARD_FLIGHT.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN ONWARD_FLIGHT.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN ONWARD_FLIGHT.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN ONWARD_FLIGHT.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
