/*****************************************************************************
*
* Filename         - $Workfile:   code_share.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 code_share table
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1998
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   code_share.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/code_share.svl  $
* 
*    Rev 1.2   21 Jun 2001 14:47:16   tagtrak
* OR:
* CR:
* Re-baseline version 4.0.0 to include patches.
* 
*    Rev 1.1   12 Oct 1998 16:43:18   tagtrak
* OR: 12682 12683 12678 12654 12419 12265 12805 12285
* CR: 12682 12683 12678 12654 12419 12265 12805
* REV:
* Vienna enhancements/fixes for database V0.4.1E
* branch ATS revision moved to trunk.
* Andrew Walker
* 
*    Rev 1.0.1.0   25 Sep 1998 13:51:08   tagtrak
* OR: 12682 12683 12678 12654 12419 12265 12285
* CR: 12682 12683 12678 12654 12419 12265
* REV:
* Vienna enhancements for Database 0.4.1
* Andrew Walker
* 
*    Rev 1.0   03 Jun 1998 13:22:54   tagtrak
* Initial check-in to PVCS
*
****************************************************************************/

PROMPT Creating Table CODE_SHARE

create table code_share (
   direction                     char(1),
   op_carrier                    char(3),
   op_fltno                      char(5),
   op_date                       date,
   cs_carrier                    char(3),
   cs_fltno                      char(5),
   cs_date                       date,
   timestamp                     date,
   airport_code                  varchar2(3) 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 code_share add ( constraint code_share_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table code_share add ( constraint check_direction check ( direction in ('I', 'O') ));

COMMENT ON TABLE CODE_SHARE IS 'This table contains details about code share flights';

COMMENT ON COLUMN CODE_SHARE.AIRPORT_CODE IS  'Airport code';
COMMENT ON COLUMN CODE_SHARE.CS_CARRIER IS  'Code share flight carrier';
COMMENT ON COLUMN CODE_SHARE.CS_DATE IS  'Code share flight date';
COMMENT ON COLUMN CODE_SHARE.CS_FLTNO IS  'Code share flight number';
COMMENT ON COLUMN CODE_SHARE.DIRECTION IS  'Direction';
COMMENT ON COLUMN CODE_SHARE.OP_CARRIER IS  'Master flight carrier';
COMMENT ON COLUMN CODE_SHARE.OP_DATE IS  'Master flight date';
COMMENT ON COLUMN CODE_SHARE.OP_FLTNO IS  'Master flight number';
COMMENT ON COLUMN CODE_SHARE.TIMESTAMP IS  'Date and time the row created ';
COMMENT ON COLUMN CODE_SHARE.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN CODE_SHARE.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN CODE_SHARE.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN CODE_SHARE.CUSER IS 'The user who created the row';
COMMENT ON COLUMN CODE_SHARE.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN CODE_SHARE.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN CODE_SHARE.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN CODE_SHARE.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN CODE_SHARE.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
