/*****************************************************************************
*
* Filename         - $Workfile:   codeshare_config.sql  $
*
*                     Name              Date      Version     CR Number 15824
*                      Yomi Kogge       24/03/02  1.0
* 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: codeshare_config table and associated items
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/

PROMPT Creating table CODESHARE_CONFIG

create table codeshare_config
( 
   OP_FLIGHTNO                   VARCHAR2(10) NOT NULL,
   CS_FLIGHTNO                   VARCHAR2(10) NOT NULL,
   START_DATE                    DATE         NOT NULL,
   END_DATE                      DATE         NOT NULL,
   SCHEDULE                      VARCHAR2(10) NOT NULL,
   WEEKDAY                       VARCHAR2(10),
   AGENT_CODE                    VARCHAR2(5)  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 codeshare_config add ( constraint codeshare_config_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table codeshare_config add ( constraint code_share_config_uk1 unique (op_flightno,cs_flightno) using index tablespace &1._indexes);

alter table codeshare_config add constraint weekday_check check (weekday in ('MON','TUE','WED','THU','FRI','THUR','FRI','SAT','SUN'));

COMMENT ON TABLE CODESHARE_CONFIG IS 'This table contains code share flight configuration data';

COMMENT ON COLUMN CODESHARE_CONFIG.AGENT_CODE IS  'Agent code';
COMMENT ON COLUMN CODESHARE_CONFIG.CS_FLIGHTNO IS  'Code share flight number';
COMMENT ON COLUMN CODESHARE_CONFIG.END_DATE IS  'End date for the code share operation';
COMMENT ON COLUMN CODESHARE_CONFIG.OP_FLIGHTNO IS  'Master flight number';
COMMENT ON COLUMN CODESHARE_CONFIG.SCHEDULE IS  'DAILY or WEEKLY to specify the codeshare occurs every day or once a week';
COMMENT ON COLUMN CODESHARE_CONFIG.START_DATE IS  'Start date for the code share flight operation ';
COMMENT ON COLUMN CODESHARE_CONFIG.WEEKDAY IS  'The operating day of the week';
COMMENT ON COLUMN CODESHARE_CONFIG.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN CODESHARE_CONFIG.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN CODESHARE_CONFIG.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN CODESHARE_CONFIG.CUSER IS 'The user who created the row';
COMMENT ON COLUMN CODESHARE_CONFIG.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN CODESHARE_CONFIG.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN CODESHARE_CONFIG.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN CODESHARE_CONFIG.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN CODESHARE_CONFIG.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
