-- ABS-28243/ ABS-33746

CREATE TABLE UNIQUEORPACKRAGCONTENTS
(
  UNIQUEORPACKCONTENTS_ID NUMBER NOT NULL,
  RAGGEDITEM_ID           NUMBER NOT NULL,
  SYSTEMUSER_ID           NUMBER NOT NULL,
  TIMESTAMP               DATE NOT NULL
)
;

ALTER TABLE UNIQUEORPACKRAGCONTENTS
  ADD CONSTRAINT XPKUNIQUEORPACKRAGCONTENTS PRIMARY KEY (UNIQUEORPACKCONTENTS_ID, RAGGEDITEM_ID);

CREATE INDEX XIF1UNIQUEORPACKRAGCONTENTS ON UNIQUEORPACKRAGCONTENTS (UNIQUEORPACKCONTENTS_ID ASC);

CREATE INDEX XIF2UNIQUEORPACKRAGCONTENTS ON UNIQUEORPACKRAGCONTENTS (RAGGEDITEM_ID ASC);
  
ALTER TABLE UNIQUEORPACKRAGCONTENTS
  ADD CONSTRAINT UORPACKRAGCONT_UORPACKCO FOREIGN KEY (UNIQUEORPACKCONTENTS_ID)
  REFERENCES UNIQUEORPACKCONTENTS (UNIQUEORPACKCONTENTS_ID);
  
ALTER TABLE UNIQUEORPACKRAGCONTENTS
  ADD CONSTRAINT UORPACKRAGCONT_RAGGEDITEM FOREIGN KEY (RAGGEDITEM_ID)
  REFERENCES RAGGEDITEM (RAGGEDITEM_ID) ON DELETE CASCADE;