--Order 20010826.110

--------------UNIQUEITEMNONPOOL-------------------

ALTER TABLE UNIQUEITEMNONPOOL
DROP CONSTRAINT UNIQUEITEMNONPOOL_REPLACEMENTW;


ALTER TABLE UNIQUEITEMNONPOOL
ADD CONSTRAINT UNIQUEITEMNONPOOL_REPLACEMENTW FOREIGN KEY (REPLACEMENTWORKORDERLINE_ID) REFERENCES WORKORDERLINE (WORKORDERLINE_ID) ON DELETE SET NULL;

--------------SOILTICKET-------------------

ALTER TABLE SOILTICKET
DROP CONSTRAINT SOILTICKET_ROUTECONTROL_ID;


ALTER TABLE SOILTICKET
ADD CONSTRAINT SOILTICKET_ROUTECONTROL_ID FOREIGN KEY (ROUTECONTROL_ID) REFERENCES ROUTECONTROL (ROUTECONTROL_ID) ON DELETE SET NULL;


ALTER TABLE SOILTICKET
DROP CONSTRAINT SOILTICKET_STOP_ID;


ALTER TABLE SOILTICKET
ADD CONSTRAINT SOILTICKET_STOP_ID FOREIGN KEY (STOP_ID) REFERENCES STOP (STOP_ID) ON DELETE SET NULL;


--------------WORKORDER-------------------

ALTER TABLE WORKORDER
DROP CONSTRAINT WORKORDER_CREDITWORKORDER_ID;


ALTER TABLE WORKORDER
ADD CONSTRAINT WORKORDER_CREDITWORKORDER_ID FOREIGN KEY (CREDITWORKORDER_ID) REFERENCES WORKORDER (WORKORDER_ID) ON DELETE SET NULL;


ALTER TABLE WORKORDER
DROP CONSTRAINT WORKORDER_ROUTECONTROL_ID;


ALTER TABLE WORKORDER
ADD CONSTRAINT WORKORDER_ROUTECONTROL_ID FOREIGN KEY (ROUTECONTROL_ID) REFERENCES ROUTECONTROL (ROUTECONTROL_ID) ON DELETE SET NULL;


ALTER TABLE WORKORDER
DROP CONSTRAINT WORKORDER_STOP_ID;


ALTER TABLE WORKORDER
ADD CONSTRAINT WORKORDER_STOP_ID FOREIGN KEY (STOP_ID) REFERENCES STOP (STOP_ID) ON DELETE SET NULL;


--------------INVOICEHEADER----------------

ALTER TABLE INVOICEHEADER
DROP CONSTRAINT INVOICEHEADER_ROUTECONTROL_ID;



ALTER TABLE INVOICEHEADER
ADD CONSTRAINT INVOICEHEADER_ROUTECONTROL_ID FOREIGN KEY (ROUTECONTROL_ID) REFERENCES ROUTECONTROL (ROUTECONTROL_ID) ON DELETE SET NULL;



ALTER TABLE INVOICEHEADER
DROP CONSTRAINT INVOICEHEADER_STOP_ID;



ALTER TABLE INVOICEHEADER
ADD CONSTRAINT INVOICEHEADER_STOP_ID FOREIGN KEY (STOP_ID) REFERENCES STOP (STOP_ID) ON DELETE SET NULL;


--------------PICKLIST----------------

ALTER TABLE PICKLIST
DROP CONSTRAINT PICKLIST_ROUTECONTROL_ID;


ALTER TABLE PICKLIST
ADD CONSTRAINT PICKLIST_ROUTECONTROL_ID FOREIGN KEY (ROUTECONTROL_ID) REFERENCES ROUTECONTROL (ROUTECONTROL_ID) ON DELETE SET NULL;


