-- ABS-47385/ ABS-48378

--BUSINESSUNITINTERNALCALCINFO table---
ALTER TABLE BUSINESSUNITINTERNALCALCINFO ADD (INVOICEBUSINESSUNIT_ID NUMBER NULL);

CREATE UNIQUE INDEX XAK1BUSINESSUNITINTERNCALCINFO ON BUSINESSUNITINTERNALCALCINFO (BUSINESSUNIT_ID ASC, INTERNALPROCESSINGBU_ID ASC, INVOICEBUSINESSUNIT_ID ASC);

CREATE INDEX XIF5BUSINESSUNITINTERNCALCINFO ON BUSINESSUNITINTERNALCALCINFO (INVOICEBUSINESSUNIT_ID ASC);

ALTER TABLE BUSINESSUNITINTERNALCALCINFO
  ADD CONSTRAINT BUINTERNALCALC_INVBU FOREIGN KEY (INVOICEBUSINESSUNIT_ID)
  REFERENCES BUSINESSUNIT (BUSINESSUNIT_ID);

---COSTPRICELIST table---
ALTER TABLE COSTPRICELIST ADD (INVOICEBUSINESSUNIT_ID NUMBER NULL);

CREATE INDEX XIF4COSTPRICELIST ON COSTPRICELIST (INVOICEBUSINESSUNIT_ID ASC);

ALTER TABLE COSTPRICELIST
  ADD CONSTRAINT COSTPRICELIST_INVBU FOREIGN KEY (INVOICEBUSINESSUNIT_ID)
  REFERENCES BUSINESSUNIT (BUSINESSUNIT_ID);

