PROMPT Creating table REFLIGHT_SETUP

CREATE TABLE REFLIGHT_SETUP ( 
   SITE_ID                       NUMBER  (10)  NOT NULL, 
   CARRIER                       CHAR    (3)	 NOT NULL,
   BAGS_PER_FLIGHT               NUMBER  (6)   DEFAULT 0,
   MINS_IN_FUTURE                NUMBER  (6)   DEFAULT 0,
   SEND_WT_MSG                   VARCHAR2(1)   DEFAULT 'N',
   TAG_DEFAULT                   VARCHAR2(1),
   TAG_OTHER                     VARCHAR2(1),
   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 reflight_setup add ( constraint reflight_setup_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table reflight_setup add ( constraint reflight_setup_uk1 unique (SITE_ID,CARRIER) using index tablespace &1._indexes);

alter table REFLIGHT_SETUP add constraint REFLIGHT_SETUP_FK_CARRIER foreign key (CARRIER)
  references CARRIER_LOOKUP (ALPHA_CODE);
  
alter table REFLIGHT_SETUP add constraint REFLIGHT_SETUP_FK_SITE_INFO foreign key (SITE_ID)
  references SITE_INFO (SITE_ID);
  
alter table reflight_setup add constraint RS_TAG_DEFAULT_CH check ( tag_default in ('F','O'));

alter table reflight_setup add constraint RS_TAG_OTHER_CH check ( tag_other in ('F','O'));

COMMENT ON TABLE REFLIGHT_SETUP IS 'This table contains reflight setup information';

COMMENT ON COLUMN REFLIGHT_SETUP.BAGS_PER_FLIGHT IS  'Number of bags per flight';
COMMENT ON COLUMN REFLIGHT_SETUP.CARRIER IS  'Carrier code';
COMMENT ON COLUMN REFLIGHT_SETUP.MINS_IN_FUTURE IS  'The number of minutes in the future to start looking for flights that can be used for re-flighting a bag';
COMMENT ON COLUMN REFLIGHT_SETUP.SEND_WT_MSG IS  'Flag to indicate if the FWD message is to be sent to the WorldTracer package or not';
COMMENT ON COLUMN REFLIGHT_SETUP.SITE_ID IS  'Site identifier';
COMMENT ON COLUMN REFLIGHT_SETUP.TAG_DEFAULT IS  'Type of tag to be printed';
COMMENT ON COLUMN REFLIGHT_SETUP.TAG_OTHER IS  'The other type of tag carrier will permit being printed';
COMMENT ON COLUMN REFLIGHT_SETUP.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN REFLIGHT_SETUP.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN REFLIGHT_SETUP.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN REFLIGHT_SETUP.CUSER IS 'The user who created the row';
COMMENT ON COLUMN REFLIGHT_SETUP.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN REFLIGHT_SETUP.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN REFLIGHT_SETUP.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN REFLIGHT_SETUP.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN REFLIGHT_SETUP.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
