-- ABS-70817 / ABS-81833
--- CONTRACTSTDINVENTORYCUST ---
CREATE TABLE CONTRACTSTDINVENTORYCUST
(
CONTRACTSTDINVENTORY_ID NUMBER NOT NULL,
STANDARDINVENTORY_ID NUMBER NOT NULL,
SYSTEMUSER_ID NUMBER NOT NULL,
TIMESTAMP DATE NOT NULL
);

ALTER TABLE CONTRACTSTDINVENTORYCUST ADD CONSTRAINT XPKCONTRACTSTDINVENTORYCUST PRIMARY KEY (CONTRACTSTDINVENTORY_ID, STANDARDINVENTORY_ID);

CREATE UNIQUE INDEX XAK1CONTRACTSTDINVENTORYCUST ON CONTRACTSTDINVENTORYCUST (STANDARDINVENTORY_ID ASC);
CREATE INDEX XIF1CONTRACTSTDINVENTORYCUST ON CONTRACTSTDINVENTORYCUST (CONTRACTSTDINVENTORY_ID ASC);

ALTER TABLE CONTRACTSTDINVENTORYCUST ADD CONSTRAINT CONTRACTSTDINVENTORYCUST_CSID FOREIGN KEY (CONTRACTSTDINVENTORY_ID)
REFERENCES CONTRACTSTDINVENTORY (CONTRACTSTDINVENTORY_ID) ON DELETE CASCADE;

ALTER TABLE CONTRACTSTDINVENTORYCUST ADD CONSTRAINT CONTRACTSTDINVENTORYCUST_SDID FOREIGN KEY (STANDARDINVENTORY_ID)
REFERENCES STANDARDINVENTORY (STANDARDINVENTORY_ID) ON DELETE CASCADE;