-- ABS-39701/ ABS-42623

ALTER TABLE WEARERINVENTORYCREDIT ADD (LOSSCHARGEINVOICELINE_ID NUMBER NULL);


DROP INDEX XAK1WEARERINVENTORYCREDIT;
CREATE UNIQUE INDEX XAK1WEARERINVENTORYCREDIT ON WEARERINVENTORYCREDIT (WEARERINVENTORY_ID ASC, RETURNDATE ASC, INVOICEHEADER_ID ASC, LOSSCHARGEINVOICELINE_ID ASC);

CREATE INDEX XIF2WEARERINVENTORYCREDIT ON WEARERINVENTORYCREDIT (LOSSCHARGEINVOICELINE_ID ASC);

ALTER TABLE WEARERINVENTORYCREDIT
  ADD CONSTRAINT WEARERINVENTORYCREDIT_INVLINE FOREIGN KEY (LOSSCHARGEINVOICELINE_ID)
  REFERENCES INVOICELINE (INVOICELINE_ID) ON DELETE CASCADE;
