-- ABS-44471 / ABS-45142
ALTER TABLE CLEANROOMBATCHCONTENT MODIFY (UNIQUEITEM_ID NULL);

ALTER TABLE CLEANROOMBATCHCONTENT ADD (RAGGEDITEM_ID NUMBER NULL);

DROP INDEX XAK1CLEANROOMBATCHCONTENT;
CREATE UNIQUE INDEX XAK1CLEANROOMBATCHCONTENT ON CLEANROOMBATCHCONTENT (NVL(UNIQUEITEM_ID, RAGGEDITEM_ID) ASC, CLEANROOMBATCH_ID ASC);

CREATE INDEX XIF8CLEANROOMBATCHCONTENT ON CLEANROOMBATCHCONTENT (RAGGEDITEM_ID ASC);

ALTER TABLE CLEANROOMBATCHCONTENT
  ADD CONSTRAINT CLEANROOMBATCHCONTENT_RAGITEM FOREIGN KEY (RAGGEDITEM_ID)
  REFERENCES RAGGEDITEM (RAGGEDITEM_ID);
