--SMG request 

-- Add/modify columns 
ALTER TABLE STOCKTRANSACTION
	ADD (OLDSIZEDEFINITION_ID NUMBER NULL);

COMMENT ON COLUMN STOCKTRANSACTION.OLDSIZEDEFINITION_ID IS 'This is filled when an item is put back on stock with a different size, its old size is then stored here';

CREATE  INDEX XIF8STOCKTRANSACTION ON STOCKTRANSACTION
(OLDSIZEDEFINITION_ID   ASC);

ALTER TABLE STOCKTRANSACTION
ADD CONSTRAINT STOCKTRANSACTION_OLDSIZE FOREIGN KEY (OLDSIZEDEFINITION_ID) REFERENCES SIZEDEFINITION (SIZEDEFINITION_ID) ON DELETE SET NULL;


-- Add/modify columns 
alter table ERP_O_STOCKTRANSACTION add OLDSIZECODE varchar2(12);

-- Add comments to the columns 
comment on column ERP_O_STOCKTRANSACTION.OLDSIZECODE
  is 'old size code, will be used when an item is returned to stock with a new size, this contains the uniqueitems old size then';