-- this script update the tables TASKANA_SCHEMA_VERSION and TASK.

SET SCHEMA %schemaName%;

INSERT INTO TASKANA_SCHEMA_VERSION (VERSION, CREATED) VALUES ('1.0.6', CURRENT_TIMESTAMP);

ALTER TABLE TASK ADD COLUMN EXTERNAL_ID VARCHAR(64) NOT NULL DEFAULT '';

UPDATE TASK T1 SET(EXTERNAL_ID) = ('ETI:' CONCAT (SELECT RIGHT(ID, (LENGTH(ID) - 4) ) FROM TASK T2 WHERE T1.ID = T2.ID));

ALTER TABLE TASK ADD CONSTRAINT UC_EXTERNAL_ID UNIQUE (EXTERNAL_ID);
