--order 502567, i-test no.6 (analysis changed)


/*
      CHANGE REPORT for Table WORKORDERLINE
          - Adding a new relationship WORKORDERLINE_OLDWEARERINVENTO
          WARNING : Create FK statement may fail (existing data may violate the new FK rules: adding a new FK WORKORDERLINE_OLDWEARERINVENTO of table WORKORDERLINE, which references table WEARERINVENTORY).
          - Adding column REPLACEOPTION
          - Adding column OLDWEARERINVENTORY_ID
      ACTION is ALTER or modify Table WORKORDERLINE
      */


ALTER TABLE WORKORDERLINE ADD (REPLACEOPTION        NUMBER DEFAULT 0 NOT NULL
                                   CONSTRAINT ReplaceOption_Valid
                                          CHECK (REPLACEOPTION IN (0, 1, 2, 3, 4, 5)));


ALTER TABLE WORKORDERLINE ADD (OLDWEARERINVENTORY_ID NUMBER NULL);

CREATE INDEX XIF13WORKORDERLINE ON WORKORDERLINE
(
       OLDWEARERINVENTORY_ID          ASC
);


ALTER TABLE WORKORDERLINE
       ADD  ( CONSTRAINT WORKORDERLINE_OLDWEARERINVENTO
              FOREIGN KEY (OLDWEARERINVENTORY_ID)
                             REFERENCES WEARERINVENTORY 
                             ON DELETE SET NULL ) ;






