-- ABS-35936

---------- WASHINGPROCESS ----------
ALTER TABLE WASHINGPROCESS ADD DURATION NUMBER;

COMMENT ON COLUMN WASHINGPROCESS.DURATION
  IS 'process duration in minutes';
 
 
---------- WASHINGPROCESSALTERNATIVE ----------  
CREATE SEQUENCE SEQ_WASHINGPROCESSALTERNATIVE
START WITH 1
INCREMENT BY 1;


CREATE TABLE WASHINGPROCESSALTERNATIVE
( WASHINGPROCESSALTERNATIVE_ID NUMBER NOT NULL,
  WASHINGPROCESS_ID            NUMBER NOT NULL,
  ALTERNATIVEWASHINGPROCESS_ID NUMBER NOT NULL,
  SYSTEMUSER_ID                NUMBER NOT NULL,
  TIMESTAMP                    DATE NOT NULL);
 
ALTER TABLE WASHINGPROCESSALTERNATIVE
  ADD CONSTRAINT XPKWASHINGPROCESSALTERNATIVE PRIMARY KEY (WASHINGPROCESSALTERNATIVE_ID);
  
ALTER TABLE WASHINGPROCESSALTERNATIVE
  ADD CONSTRAINT WASHINGPROCESS FOREIGN KEY (WASHINGPROCESS_ID)
  REFERENCES WASHINGPROCESS (WASHINGPROCESS_ID) ON DELETE CASCADE;
  
ALTER TABLE WASHINGPROCESSALTERNATIVE
  ADD CONSTRAINT WASHINGPROCESS_ALT FOREIGN KEY (ALTERNATIVEWASHINGPROCESS_ID)
  REFERENCES WASHINGPROCESS (WASHINGPROCESS_ID) ON DELETE CASCADE;
  
ALTER TABLE WASHINGPROCESSALTERNATIVE
  ADD CONSTRAINT XAK1WASHINGPROCESS UNIQUE (WASHINGPROCESS_ID, ALTERNATIVEWASHINGPROCESS_ID);

