/*****************************************************************************
*
* Filename         - $Workfile:   class_list.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - See revision history.
* Last Update      - See revision history.
*
* Project Name     - TAGTRAK(Oracle database)
*
* Source Code
* Identifier       - 
*
* Design Spec
* Section          -
*
* Contents         - Live schema class_list table definition
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2006
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   class_list.sql  $  $Revision:   1.0  $
*
* 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:     $
* 
*    Rev 1.0   10 Oct 2006 12:29:00   himanshu.saini
* CA:2092
* DESC: New tables for storing class list in database
*
*****************************************************************************/

PROMPT Creating table CLASS_LIST

CREATE TABLE class_list
(
   airline_alpha_code            CHAR(3) NOT NULL,
   ticket_class                  CHAR(1) NOT NULL,
   cabin_class                   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 class_list add ( constraint class_list_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table class_list add ( constraint class_list_uk1 unique (airline_alpha_code,ticket_class,cabin_class) using index tablespace &1._indexes);

alter table class_list add (constraint class_list_fk_carrier_lookup foreign key (airline_alpha_code) references carrier_lookup(alpha_code));

COMMENT ON TABLE CLASS_LIST IS 'This table contains details of ticket and cabin classes for each airline carrier';

COMMENT ON COLUMN CLASS_LIST.AIRLINE_ALPHA_CODE IS  'Carrier code';
COMMENT ON COLUMN CLASS_LIST.CABIN_CLASS IS  'Cabin class';
COMMENT ON COLUMN CLASS_LIST.TICKET_CLASS IS  'Ticket class';
COMMENT ON COLUMN CLASS_LIST.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN CLASS_LIST.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN CLASS_LIST.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN CLASS_LIST.CUSER IS 'The user who created the row';
COMMENT ON COLUMN CLASS_LIST.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN CLASS_LIST.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN CLASS_LIST.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN CLASS_LIST.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN CLASS_LIST.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
