/*****************************************************************************
*
* Filename         - $Workfile:   flight_dests.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: Flight_dests table and associated items
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   flight_dests.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/flight_dests.svl  $
 * 
 *    Rev 1.3   06 Jun 2000 09:53:18   tagtrak
 *  
 * 
 *    Rev 1.2.1.2   10 Jun 1999 14:51:46   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:00   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial Issue
 * See label for concession
 * 
 *    Rev 1.1   26 Feb 1998 11:07:48   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial core product version
 * 
 *    Rev 1.0   22 Oct 1997 11:07:46   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial check-in
*
****************************************************************************/

PROMPT Creating table FLIGHT_DESTS

create table FLIGHT_DESTS (
   FLIGHT_ID                     number(10) NOT NULL,
   FLIGHT_DESTINATION            char(3) NOT NULL,
   DEST_ORDER                    number(6),
   DEST_SOURCE                   char(1) 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 flight_dests add ( constraint flight_dests_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table flight_dests add ( constraint flight_dests_uk1 unique (flight_id,flight_destination,dest_source) using index tablespace &1._indexes);

alter table flight_dests add ( constraint flight_dests_fk_flight foreign key (flight_id) references flight (flight_id) on delete cascade);

create index FLIGHT_DESTS_SK1 on FLIGHT_DESTS(FLIGHT_ID) tablespace &1._indexes;

COMMENT ON TABLE FLIGHT_DESTS IS 'This table contains the flight destinations for each flight';

COMMENT ON COLUMN FLIGHT_DESTS.DEST_ORDER IS  'The order of this destination for this flight';
COMMENT ON COLUMN FLIGHT_DESTS.DEST_SOURCE IS  'The source of the destination information, B=BSM F=FIDS';
COMMENT ON COLUMN FLIGHT_DESTS.FLIGHT_DESTINATION IS  'Destination';
COMMENT ON COLUMN FLIGHT_DESTS.FLIGHT_ID IS  'The flight identifier';
COMMENT ON COLUMN FLIGHT_DESTS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN FLIGHT_DESTS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN FLIGHT_DESTS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN FLIGHT_DESTS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN FLIGHT_DESTS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN FLIGHT_DESTS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN FLIGHT_DESTS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN FLIGHT_DESTS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN FLIGHT_DESTS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
