-- ABS-28834

ALTER TABLE WORKORDERLINE ADD (POLSEQUENCENUMBER NUMBER NULL);

COMMENT ON COLUMN WORKORDERLINE.POLSEQUENCENUMBER
  IS 'Will only be filled in case of a stock delivery order for internal PO (origin = 8) to allow multiple lines for the same product/size/ grade/reason code/code uniquely/prewash combination with different modifications';

DROP INDEX XAK1WORKORDERLINE;
CREATE UNIQUE INDEX XAK1WORKORDERLINE ON 
WORKORDERLINE (WORKORDER_ID ASC, 
               PRODUCT_LINK_ID ASC, 
               SIZEDEFINITION_LINK_ID ASC, 
               REQUESTEDGRADE_ID ASC, 
               REASONCODE_ID ASC, 
               CODEUNIQUELY ASC, 
               RENTALQTYADJUSTMENT_ID ASC, 
               NVL(REPLENISHMENTSEQUENCENUMBER,0) ASC, 
               NVL(POLSEQUENCENUMBER,0) ASC);