--Order 20013319.300

ALTER TABLE PHASEOUTWEARERINVENTORY ADD (PRODUCTCONVERSIONSIZE_ID NUMBER NULL);

ALTER TABLE PHASEOUTWEARERINVENTORY
  ADD CONSTRAINT PHASEOUTWEARERINV_PRODCONVSIZE FOREIGN KEY (PRODUCTCONVERSIONSIZE_ID)
  REFERENCES PRODUCTCONVERSIONSIZE (PRODUCTCONVERSIONSIZE_ID) ON DELETE SET NULL;


ALTER TABLE PRODUCTCONVWRINVENTORY MODIFY(DESTINATIONWISIZEDEFINITION_ID NUMBER NULL);

ALTER TABLE WORKORDERLINE
	ADD (QUANTITYPHASEIN NUMBER  DEFAULT 0 NOT NULL);

ALTER TABLE WORKORDERLINE
	ADD (PHASEINWEARERINVENTORY_ID NUMBER NULL);

COMMENT ON COLUMN WORKORDERLINE.QUANTITYPHASEIN IS 'In case of a phased out product the quantity that is issued as phase in product is stored here.';

COMMENT ON COLUMN WORKORDERLINE.PHASEINWEARERINVENTORY_ID IS 'When issueing a phase in product this is added to this wearerinventory.';

CREATE INDEX XIF14WORKORDERLINE ON WORKORDERLINE
(PHASEINWEARERINVENTORY_ID   ASC);

ALTER TABLE WORKORDERLINE
ADD CONSTRAINT WOL_PHASEINWEARERINVENTORY FOREIGN KEY (PHASEINWEARERINVENTORY_ID) REFERENCES WEARERINVENTORY (WEARERINVENTORY_ID) ON DELETE SET NULL;