rem *********************************************************************
rem *                                                                   *
rem *             Copyright (c) Ultra Electronics Airport Systems       *
rem *                           All rights reserved.                    *
rem *                                                                   *
rem *********************************************************************
rem *                                                                   *
rem * Filename:             terminals.sql                               *
rem * Module Name:          terminals                                   *
rem * Subsystem Name:       tables                                      *
rem * Originating Author:   James Creegan                               *
rem * Design Reference:     FAS/BBTRK/SD/225                            *
rem *                                                                   *
rem *********************************************************************
rem *                                                                   *
rem * Description:                                                      *
rem *  Script to create the TERMINALS table and its constraints         *
rem *********************************************************************
rem *                                                                   *
rem * Program Identification Array:                                     *
rem *                                                                   *
rem * "%Z%%M% VERSION %I% %E% %U%"
rem *                                                                   *
rem *********************************************************************
rem *                                                                   *
rem * Modification History:                                             *
rem *                                                                   *
rem * Rel Date/Time      Proj/Id   CA Ref/Details Of Change             *
rem * --- -------------- --------  ------------------------------------ *
rem * 1.0 28 May 03                File initially checked in            *
rem *********************************************************************/

PROMPT Creating table TERMINAL

CREATE TABLE terminals (
   terminal                      VARCHAR2(10) NOT NULL,
   site_id                       NUMBER (10)  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 terminals add ( constraint terminals_pk unique (appn_row_id) using index tablespace &1._indexes);

ALTER TABLE terminals ADD( CONSTRAINT terminals_uk1 unique (terminal, site_id) USING INDEX TABLESPACE &1._indexes);

COMMENT ON TABLE TERMINALS IS 'THis table constains details of the terminals';

COMMENT ON COLUMN TERMINALS.SITE_ID IS  'Site identifier';
COMMENT ON COLUMN TERMINALS.TERMINAL IS  'Terminal';
COMMENT ON COLUMN TERMINALS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN TERMINALS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN TERMINALS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN TERMINALS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN TERMINALS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN TERMINALS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN TERMINALS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN TERMINALS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN TERMINALS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
