      
      /*
      CHANGE REPORT for Table TRUCK
          - Adding a new relationship TRUCK_STOCKROOM_ID
          WARNING : Create FK statement may fail (existing data may violate the new FK rules: adding a new FK TRUCK_STOCKROOM_ID of table TRUCK, which references table STOCKROOM).
          - Adding a new relationship TRUCK_STOCKROOMLOCATION_ID
          WARNING : Create FK statement may fail (existing data may violate the new FK rules: adding a new FK TRUCK_STOCKROOMLOCATION_ID of table TRUCK, which references table STOCKROOMLOCATION).
          - Adding column STOCKROOM_ID
          - Adding column STOCKROOMLOCATION_ID
          - Adding index XAK2TRUCK
          - Adding index XIF3TRUCK
          - Adding index XIF4TRUCK
      ACTION is ALTER or modify Table TRUCK
      */

ALTER TABLE TRUCK ADD (STOCKROOM_ID         NUMBER NULL);


ALTER TABLE TRUCK ADD (STOCKROOMLOCATION_ID NUMBER NULL);

CREATE UNIQUE INDEX XAK2TRUCK ON TRUCK
(
       STOCKROOM_ID                   ASC,
       STOCKROOMLOCATION_ID           ASC
);

CREATE INDEX XIF3TRUCK ON TRUCK
(
       STOCKROOM_ID                   ASC
);

CREATE INDEX XIF4TRUCK ON TRUCK
(
       STOCKROOMLOCATION_ID           ASC
);


ALTER TABLE TRUCK
       ADD  ( CONSTRAINT TRUCK_STOCKROOM_ID
              FOREIGN KEY (STOCKROOM_ID)
                             REFERENCES STOCKROOM ) ;


ALTER TABLE TRUCK
       ADD  ( CONSTRAINT TRUCK_STOCKROOMLOCATION_ID
              FOREIGN KEY (STOCKROOMLOCATION_ID)
                             REFERENCES STOCKROOMLOCATION ) ;

