PROMPT Creating table REFLIGHT_ACCEPT_FROM

CREATE TABLE REFLIGHT_ACCEPT_FROM ( 
   SITE_ID                       NUMBER(10)    NOT NULL,
   CARRIER                       CHAR (3)      NOT NULL, 
   ACCEPT_FROM_CARRIER           CHAR (3)      NOT NULL, 
   ADD_RUSH_AUTH                 VARCHAR2 (1)  DEFAULT 'N',
   BAGS_PER_FLIGHT               NUMBER(6)     DEFAULT 0,
   MINS_IN_FUTURE                NUMBER(6)     DEFAULT 0,
   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_accept_from add ( constraint reflight_accept_from_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table reflight_accept_from add ( constraint reflight_accept_from_uk1 unique (SITE_ID,CARRIER,ACCEPT_FROM_CARRIER) using index tablespace &1._indexes);

ALTER TABLE reflight_accept_from ADD CONSTRAINT refacf_fk_refset FOREIGN KEY (site_id, carrier) REFERENCES reflight_setup (site_id, carrier) ON DELETE CASCADE;

COMMENT ON TABLE REFLIGHT_ACCEPT_FROM IS 'This table contains configuration of which carriers a carrier will accept rush bags from for reflighting';

COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.ACCEPT_FROM_CARRIER IS  'The original carrier of the rush bag';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.ADD_RUSH_AUTH IS  'Flag to indicate whether a re-flighted rush bag from the ACCEPT_FROM_
CARRIER is added as authorised or not to the flight operated by the CARRIER';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.BAGS_PER_FLIGHT IS  'The number of reflighted bags CARRIER will accept per flight from the ACCEPT_FROM_CARRIER';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.CARRIER IS  'Flight carrier';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.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_ACCEPT_FROM.SITE_ID IS  'Site identifier';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.CUSER IS 'The user who created the row';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN REFLIGHT_ACCEPT_FROM.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
