-- ABS-35937
CREATE SEQUENCE SEQ_MACHINEWASHINGPROCESS
START WITH 1
INCREMENT BY 1;

CREATE TABLE MACHINEWASHINGPROCESS
( MACHINEWASHINGPROCESS_ID NUMBER NOT NULL,
  MACHINE_ID               NUMBER NOT NULL,
  WASHINGPROCESS_ID        NUMBER NOT NULL,
  SYSTEMUSER_ID            NUMBER NOT NULL,
  TIMESTAMP                DATE NOT NULL);

ALTER TABLE MACHINEWASHINGPROCESS
  ADD CONSTRAINT XPKMACHINEWASHINGPROCESS PRIMARY KEY (MACHINEWASHINGPROCESS_ID);

CREATE UNIQUE INDEX XAK1MACHINEWASHINGPROCESS ON MACHINEWASHINGPROCESS (MACHINE_ID ASC, WASHINGPROCESS_ID ASC);
CREATE INDEX XIF1MACHINEWASHINGPROCESS ON MACHINEWASHINGPROCESS (MACHINE_ID ASC);
CREATE INDEX XIF2MACHINEWASHINGPROCESS ON MACHINEWASHINGPROCESS (WASHINGPROCESS_ID ASC);


ALTER TABLE MACHINEWASHINGPROCESS
  ADD CONSTRAINT MACHINEWASHINGPROCESS_MACHINE FOREIGN KEY (MACHINE_ID)
  REFERENCES MACHINE (MACHINE_ID);
  
ALTER TABLE MACHINEWASHINGPROCESS
  ADD CONSTRAINT MACHINEWASHINGPROCESS_WASHPRC FOREIGN KEY (WASHINGPROCESS_ID)
  REFERENCES WASHINGPROCESS (WASHINGPROCESS_ID);
