/*****************************************************************************
*
* Filename         - $Workfile:   loading_totals.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 loading_totals table
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1998
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   loading_totals.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:   /pvcsarch/db_ora/db/source/live/tables/loading_totals.svl  $
* 
*    Rev 1.0   06 Jun 2000 09:53:56   tagtrak
* Initial revision
*
*****************************************************************************/

PROMPT Creating table LOADING_TOTALS

CREATE TABLE loading_totals(
   flight_date                   DATE     NOT NULL ,
   carrier                       VARCHAR2(24) NOT NULL ,
   alpha_code                    CHAR(3)    NOT NULL ,
   flight_no                     CHAR(8)    NOT NULL,
   loaded                        NUMBER    DEFAULT 0,
   transfer                      NUMBER    DEFAULT 0,
   local                         NUMBER    DEFAULT 0,
   rush                          NUMBER    DEFAULT 0,
   other                         NUMBER    DEFAULT 0,
   short                         NUMBER    DEFAULT 0,
   deleted                       NUMBER    DEFAULT 0,
   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 loading_totals add ( constraint loading_totals_pk primary key (appn_row_id) using index tablespace &1._indexes);

ALTER TABLE loading_totals ADD CONSTRAINT loading_totals_uk1 unique (flight_date, flight_no) USING INDEX TABLESPACE &1._indexes;

COMMENT ON TABLE LOADING_TOTALS IS 'This table contains loading totals for each flight';

COMMENT ON COLUMN LOADING_TOTALS.ALPHA_CODE IS  'Carrier code';
COMMENT ON COLUMN LOADING_TOTALS.CARRIER IS  'Carrier name';
COMMENT ON COLUMN LOADING_TOTALS.DELETED IS  'Number of deleted bags';
COMMENT ON COLUMN LOADING_TOTALS.FLIGHT_DATE IS  'Flight date';
COMMENT ON COLUMN LOADING_TOTALS.FLIGHT_NO IS  'Flight number';
COMMENT ON COLUMN LOADING_TOTALS.LOADED IS  'Number of bags loaded';
COMMENT ON COLUMN LOADING_TOTALS.LOCAL IS  'Number of local bags';
COMMENT ON COLUMN LOADING_TOTALS.OTHER IS  'Number of other bags';
COMMENT ON COLUMN LOADING_TOTALS.RUSH IS  'Number of rush bags';
COMMENT ON COLUMN LOADING_TOTALS.SHORT IS  'Number of short bags';
COMMENT ON COLUMN LOADING_TOTALS.TRANSFER IS  'Number of transfer bags';
COMMENT ON COLUMN LOADING_TOTALS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN LOADING_TOTALS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN LOADING_TOTALS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN LOADING_TOTALS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN LOADING_TOTALS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN LOADING_TOTALS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN LOADING_TOTALS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN LOADING_TOTALS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN LOADING_TOTALS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
