--- SCAN table ---

ALTER TABLE SCAN
  DROP COLUMN MARKDELETE CASCADE CONSTRAINTS;
  
DROP INDEX TIDXSCAN;

DROP INDEX XIE2SCAN;

DROP INDEX XIE5SCAN;

DROP INDEX XIF1SCAN;

DROP INDEX XIF6SCAN;

DROP INDEX XIF7SCAN;

DROP INDEX XIF8SCAN;

DROP INDEX XIF9SCAN;

DROP INDEX XIF11SCAN;

DROP INDEX XIF12SCAN;

DROP INDEX XIF13SCAN;	

DROP INDEX XIF14SCAN;	

DROP INDEX XIF15SCAN;	

DROP INDEX XIF17SCAN;	

DROP INDEX XIF18SCAN;	

DROP INDEX XIF19SCAN;	

ALTER TABLE SCAN
	ADD (DELIVERYNOTENUMBER NUMBER NULL);

COMMENT ON COLUMN SCAN.DELIVERYNOTENUMBER IS 'In case of an outscan this can be filled with the delivery note number.No default (null)';


--- DELIVERYSCAN table ---

DROP INDEX TIDXDELIVERYSCAN;

DROP INDEX XIF12DELIVERYSCAN;

DROP INDEX XIF13DELIVERYSCAN;

DROP INDEX XIF14DELIVERYSCAN;

DROP INDEX XIF16DELIVERYSCAN;

DROP INDEX XIF1DELIVERYSCAN;

DROP INDEX XIF3DELIVERYSCAN;

DROP INDEX XIF4DELIVERYSCAN;

DROP INDEX XIF5DELIVERYSCAN;

DROP INDEX XIF6DELIVERYSCAN;

DROP INDEX XIF7DELIVERYSCAN;

DROP INDEX XIF8DELIVERYSCAN;

DROP INDEX XIF9DELIVERYSCAN;


--- UNIQUEITEM table ---

ALTER TABLE UNIQUEITEM
	ADD (LASTDELIVERYNOTENUMBER NUMBER NULL);

COMMENT ON COLUMN UNIQUEITEM.LASTDELIVERYNOTENUMBER IS 'Only populated for multiread scanned pool items at the delivery note.';

DROP INDEX XIF10UNIQUEITEM;

DROP INDEX XIF5UNIQUEITEM;

DROP INDEX XIF6UNIQUEITEM;