-- ABS-95122 / ABS-98142
ALTER TABLE VERTEXTRANSACTIONLOG DROP CONSTRAINT CHK_VERTEXLOG_STATUS;

COMMENT ON COLUMN VERTEXTRANSACTIONLOG.STATUS IS '0 = New (default): The Batch Client Interface has not processed this new line item.
1 = Processing: The Batch Client Interface is processing this line item.
2 = OK: The Batch Client Interface processed this line item successfully.
3 = Skipped: The Batch Client Interface skipped the line item because it already exists in the Tax Journal. 
4 = Failed: The Batch Client Interface did not process this line item because a field associated with this line item or another line item within the same transaction was invalid.
5 = WebService generated line';

CREATE INDEX XIF1VERTEXTRANSACTIONLOG ON VERTEXTRANSACTIONLOG (BATCHID ASC);

ALTER TABLE VERTEXTRANSACTIONLOG ADD CONSTRAINT FK_VERTEXTRANSLOG_BATCH FOREIGN KEY (BATCHID)
REFERENCES VERTEXBATCHCONTROL (BATCHID);

ALTER TABLE VERTEXTRANSACTIONLOG ADD CONSTRAINT CHK_VERTEXLOG_STATUS CHECK (STATUS IN (0,1,2,3,4,5));
