--TD 21180.50 (Transfer Customers gives error message)

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_CUSTOME;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_NEWDRIV;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_DRIVING;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_DELIVER;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_NEWDELI;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_DELIVS;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_PLANT_I;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_PRODUCT;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_NEWROUT;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_ROUTE_I;

ALTER TABLE ROUTECHANGETRANSACTION
DROP CONSTRAINT ROUTECHANGETRANSACTION_ROUTEST;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_CUSTOME FOREIGN KEY (CUSTOMER_ID) REFERENCES CUSTOMER (CUSTOMER_ID) ON DELETE CASCADE;  

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_NEWDRIV FOREIGN KEY (NEWDRIVINGDAY_ID) REFERENCES DAY (DAY_ID) ON DELETE SET NULL;
  
ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_DRIVING FOREIGN KEY (DRIVINGDAY_ID) REFERENCES DAY (DAY_ID) ON DELETE SET NULL;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_DELIVER FOREIGN KEY (DELIVERYPOINT_ID) REFERENCES DELIVERYPOINT (DELIVERYPOINT_ID) ON DELETE SET NULL;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_NEWDELI FOREIGN KEY (NEWDELIVERYSCHEME_ID) REFERENCES DELIVERYSCHEME (DELIVERYSCHEME_ID) ON DELETE SET NULL;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_DELIVS FOREIGN KEY (DELIVERYSCHEME_ID) REFERENCES DELIVERYSCHEME (DELIVERYSCHEME_ID) ON DELETE SET NULL;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_PLANT_I FOREIGN KEY (PLANT_ID) REFERENCES PLANT (PLANT_ID) ON DELETE CASCADE;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_PRODUCT FOREIGN KEY (PRODUCTGROUP_ID) REFERENCES PRODUCTGROUP (PRODUCTGROUP_ID) ON DELETE SET NULL;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_NEWROUT FOREIGN KEY (NEWROUTE_ID) REFERENCES ROUTE (ROUTE_ID) ON DELETE SET NULL;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_ROUTE_I FOREIGN KEY (ROUTE_ID) REFERENCES ROUTE (ROUTE_ID) ON DELETE SET NULL;

ALTER TABLE ROUTECHANGETRANSACTION
ADD CONSTRAINT ROUTECHANGETRANSACTION_ROUTEST FOREIGN KEY (ROUTESTOP_ID) REFERENCES ROUTESTOP (ROUTESTOP_ID) ON DELETE SET NULL; 

