--- ABS-123479 / ABS-124823

ALTER TABLE ROUTEEXTRAINFO ADD (MAINROUTESTARTDATE DATE NULL);

-- CORRECT EXISTING RECORDS 
UPDATE ROUTEEXTRAINFO REI
       SET REI.MAINROUTESTARTDATE = TRUNC(REI.TIMESTAMP)
       WHERE REI.MAINROUTE_ID IS NOT NULL;
COMMIT;

-- ADD CONSTRAINT
ALTER TABLE ROUTEEXTRAINFO
ADD CONSTRAINT CHK_ROUTEEXTRAINFO_ID_DATE
CHECK (((MAINROUTE_ID IS NOT NULL) AND (MAINROUTESTARTDATE IS NOT NULL)) OR ((MAINROUTE_ID IS NULL) AND (MAINROUTESTARTDATE IS NULL)));
      
COMMENT ON COLUMN ROUTEEXTRAINFO.MAINROUTESTARTDATE
        IS 'Used by COMBINEDROUTELOGISTICS module only. May only be filled when MainRoute_ID is not null, otherwise it must be null.';  