/*****************************************************************************
*
* Filename         - $Workfile:   weights.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 weights table
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1998
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   weights.sql  $  $Revision:   1.1  $
*
* 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/weights.svl  $
* 
*    Rev 1.1   21 Jun 2001 14:48:30   tagtrak
* OR:
* CR:
* Re-baseline version 4.0.0 to include patches.
* 
*    Rev 1.0   03 Jun 1998 13:23:00   tagtrak
* Initial check-in to PVCS
*
****************************************************************************/

PROMPT Creating table WEIGHTS

create table WEIGHTS (
   SITE_ID                       NUMBER(10) not null,
   CARRIER                       CHAR(3) not null,
   FLIGHT_NO                     CHAR(8),
   WEIGHT                        NUMBER(10) not null,
   UNITS                         CHAR(3),
   TIMESTAMP                     DATE,
   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 weights add ( constraint weights_pk primary key (appn_row_id) using index tablespace &1._indexes);
alter table weights
  add constraint weights_fk_carrier foreign key (carrier)
  references CARRIER_LOOKUP (ALPHA_CODE);

CREATE UNIQUE INDEX weights_uk1 ON weights(site_id, flight_no, carrier)
TABLESPACE &1._indexes;

COMMENT ON TABLE WEIGHTS IS 'This table contains the nominal weights of bags on flights';

COMMENT ON COLUMN WEIGHTS.SITE_ID IS  'Site id';
COMMENT ON COLUMN WEIGHTS.SITE_ID IS  'Carrier alpha code';
COMMENT ON COLUMN WEIGHTS.FLIGHT_NO IS  'Flight number';
COMMENT ON COLUMN WEIGHTS.TIMESTAMP IS  'Timestamp';
COMMENT ON COLUMN WEIGHTS.UNITS IS  'Weight units';
COMMENT ON COLUMN WEIGHTS.WEIGHT IS  'Weight';
COMMENT ON COLUMN WEIGHTS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN WEIGHTS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN WEIGHTS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN WEIGHTS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN WEIGHTS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN WEIGHTS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN WEIGHTS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN WEIGHTS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN WEIGHTS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';

/

