--ABS-57525
-------------------ROUTECONTROLCONTAINER

ALTER TABLE ROUTECONTROLCONTAINER
  DROP CONSTRAINT CHK_RCCONTAINER_ST;
  
ALTER TABLE ROUTECONTROLCONTAINER
  ADD CONSTRAINT CHK_RCCONTAINER_ST
  CHECK (STATUS IN (0,1, 2, 3));

COMMENT ON COLUMN ROUTECONTROLCONTAINER.STATUS
  IS '0 = Packed
1 = In transport
2 = Returned
3 = Not confirmed
';

ALTER TABLE ROUTECONTROLCONTAINER ADD (NOTCONFIRMEDREASONCODE_ID NUMBER NULL);

COMMENT ON COLUMN ROUTECONTROLCONTAINER.NOTCONFIRMEDREASONCODE_ID
  IS 'Filled via the Route Assistant when not all mat carry units are confirmed.
';

CREATE INDEX XIF2ROUTECONTROLCONTAINER ON ROUTECONTROLCONTAINER (NOTCONFIRMEDREASONCODE_ID ASC);

ALTER TABLE ROUTECONTROLCONTAINER 
  ADD CONSTRAINT FK_RCCONTAINER_REASC FOREIGN KEY (NOTCONFIRMEDREASONCODE_ID)
  REFERENCES REASONCODE(REASONCODE_ID) ON DELETE SET NULL;

DROP INDEX XAK1ROUTECONTROLCONTAINER;

CREATE INDEX XIE1ROUTECONTROLCONTAINER ON ROUTECONTROLCONTAINER (CONTAINER_ID  ASC);
