-- ABS-69595 / ABS-70451
DROP INDEX XAK1CONTRACTDEFWEARINVPRICE;

ALTER TABLE CONTRACTDEFWEARINVPRICE DROP COLUMN STANDARDINVENTORY_ID CASCADE CONSTRAINTS;

ALTER TABLE CONTRACTDEFWEARINVPRICE ADD (CONTRACTSTDINVENTORY_ID NUMBER NOT NULL);

CREATE UNIQUE INDEX XAK1CONTRACTDEFWEARINVPRICE ON CONTRACTDEFWEARINVPRICE (CONTRACTSTDINVENTORY_ID ASC, STARTDATE ASC);
CREATE INDEX XIF1CONTRACTDEFWEARINVPRICE ON CONTRACTDEFWEARINVPRICE (CONTRACTSTDINVENTORY_ID ASC);

ALTER TABLE CONTRACTDEFWEARINVPRICE ADD CONSTRAINT CONTRACTDEFWEARINVPRICE_CSTDI FOREIGN KEY (CONTRACTSTDINVENTORY_ID)
REFERENCES CONTRACTSTDINVENTORY (CONTRACTSTDINVENTORY_ID) ON DELETE CASCADE;

