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

PROMPT Creating table SITE_INFO

create table site_info(
   site_id                       number(10)   not null,
   airport_code                  varchar2(4)  not null,
   site_name                     varchar2(70) not null,
   approved_security_status      varchar2(1)  default 'N' not null,
   timezone_id                   varchar2(50),
   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 site_info add ( constraint site_info_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table site_info add ( constraint site_info_uk1 unique (site_id) using index tablespace &1._indexes);

alter table SITE_INFO add ( constraint SITE_INFO_FK_TIMEZONE_ID foreign key (TIMEZONE_ID) references TZ_DATA( ID ));

ALTER TABLE site_info ADD CONSTRAINT airport_unique UNIQUE (airport_code) USING INDEX TABLESPACE &1._indexes;

COMMENT ON TABLE SITE_INFO IS 'This table contains details of the sites and airports used by the system';

COMMENT ON COLUMN SITE_INFO.AIRPORT_CODE IS  'Airport code';
COMMENT ON COLUMN SITE_INFO.APPROVED_SECURITY_STATUS IS  'Indicates whether this airport is approved or non-approved';
COMMENT ON COLUMN SITE_INFO.SITE_ID IS  'Site identifier';
COMMENT ON COLUMN SITE_INFO.SITE_NAME IS  'Name of the airport';
COMMENT ON COLUMN SITE_INFO.TIMEZONE_ID IS 'Timezone for this site';
COMMENT ON COLUMN SITE_INFO.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN SITE_INFO.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN SITE_INFO.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN SITE_INFO.CUSER IS 'The user who created the row';
COMMENT ON COLUMN SITE_INFO.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN SITE_INFO.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN SITE_INFO.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN SITE_INFO.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN SITE_INFO.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';

