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

PROMPT Creating table TABLE TIMED_REPORT_CONFIG

create table timed_report_config(
   report_id                     number(10)  not null,
   flight_id                     number(10)          ,
   flight_no                     varchar2(9) not null,
   flight_date                   varchar2(6)         ,
   flight_dest                   varchar2(6)         ,
   airport_code                  varchar2(4)  not null,
   loginname                     varchar2(17) not null,
   report_type                   varchar2(50) not null,
   parameter1                    varchar2(20)         ,
   parameter2                    varchar2(20)         ,
   actual_offset                 number(10)   not null,
   ready_date                    date                 ,
   ready_time                    varchar2(6)          ,
   ready_flag                    varchar2(2)   default 'N' not null,
   run_time                      date                 ,            
   flight_status                 varchar2(30) not null,
   report_status                 varchar2(10)         ,
   agent_code                    varchar2(10) not null,
   report_create_date            date         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 timed_report_config add ( constraint timed_report_config_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table timed_report_config add ( constraint timed_report_config_uk1 unique (report_id) using index tablespace &1._indexes);

COMMENT ON TABLE TIMED_REPORT_CONFIG IS 'This table stores all the configuration rules that are used for automatically generating a report for a flight';

COMMENT ON COLUMN TIMED_REPORT_CONFIG.ACTUAL_OFFSET IS  'Actual offset';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.AGENT_CODE IS  'Agent code';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.AIRPORT_CODE IS  'Airport code';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.FLIGHT_DATE IS  'Flight date';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.FLIGHT_DEST IS  'Flight destination';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.FLIGHT_ID IS  'Flight identifier';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.FLIGHT_NO IS  'Flight number';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.FLIGHT_STATUS IS  'Flight status';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.LOGINNAME IS  'Login name';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.PARAMETER1 IS  'Parameter one';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.PARAMETER2 IS  'Parameter two';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.READY_DATE IS  'Ready date';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.READY_FLAG IS  'Ready flag';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.READY_TIME IS  'Ready time';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.REPORT_CREATE_DATE IS  'Date report was created';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.REPORT_ID IS  'Report identifier';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.REPORT_STATUS IS  'Status of the report';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.REPORT_TYPE IS  'Type of report';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.RUN_TIME IS  'Report run time';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.CUSER IS 'The user who created the row';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN TIMED_REPORT_CONFIG.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';

