-- Order 20011455.70 (Register supplier delivery note number per purchase order line (enter when receiving the order))

-----------------------UNIQUEITEMFIXEDINFO TABLE-------------------------

ALTER TABLE UNIQUEITEMFIXEDINFO
	ADD (PURCHASEORDERLINE_ID NUMBER NULL,
	     SUPPLIERDELNOTENUMBER VARCHAR2(20) NULL);

CREATE  INDEX XIF9UNIQUEITEMFIXEDINFO ON UNIQUEITEMFIXEDINFO
(PURCHASEORDERLINE_ID   ASC);

ALTER TABLE UNIQUEITEMFIXEDINFO
ADD CONSTRAINT UNIQUEITEMFIXEDINFO_POLINE FOREIGN KEY (PURCHASEORDERLINE_ID) REFERENCES PURCHASEORDERLINE (PURCHASEORDERLINE_ID) ON DELETE SET NULL;




-----------------------RAGGEDITEM TABLE-------------------------



ALTER TABLE RAGGEDITEM
	ADD (PURCHASEORDERLINE_ID NUMBER NULL,
	     SUPPLIERDELNOTENUMBER VARCHAR2(20) NULL);

CREATE  INDEX XIF20RAGGEDITEM ON RAGGEDITEM
(PURCHASEORDERLINE_ID   ASC); 

ALTER TABLE RAGGEDITEM
ADD CONSTRAINT RAGGEDITEM_PURCHASEORDERLINE FOREIGN KEY (PURCHASEORDERLINE_ID) REFERENCES PURCHASEORDERLINE (PURCHASEORDERLINE_ID) ON DELETE SET NULL;



-----------------------STOCKTRANSACTION TABLE-------------------------

ALTER TABLE STOCKTRANSACTION
	ADD (UNIQUEITEM_LINK_ID NUMBER NULL);

CREATE  INDEX XIF6STOCKTRANSACTION ON STOCKTRANSACTION
(UNIQUEITEM_LINK_ID   ASC); 

ALTER TABLE STOCKTRANSACTION
ADD CONSTRAINT STOCKTRANSACTION_UNIQUEITEM_LK FOREIGN KEY (UNIQUEITEM_LINK_ID) REFERENCES UNIQUEITEM_LINK (UNIQUEITEM_LINK_ID) ON DELETE SET NULL;


-----------------------RECEIVEINSTOCKHISTORY TABLE-------------------------

ALTER TABLE RECEIVEINSTOCKHISTORY
	ADD (SUPPLIERDELNOTENUMBER VARCHAR2(20) NULL);


-----------------------PURCHASEORDERSTOCKTRANSACTION TABLE-------------------------

ALTER TABLE PURCHASEORDERSTOCKTRANSACTION
	ADD (SUPPLIERDELNOTENUMBER VARCHAR2(20) NULL);







