-- this script updates the TASKANA database schema from version 5.10.0 to version 6.2.0.
ALTER
SESSION SET CURRENT_SCHEMA = %schemaName%;

INSERT INTO TASKANA_SCHEMA_VERSION (ID, VERSION, CREATED)
VALUES (TASKANA_SCHEMA_VERSION_ID_SEQ.NEXTVAL, '6.2.0', CURRENT_TIMESTAMP);

ALTER TABLE WORKBASKET_ACCESS_LIST
    ADD PERM_READTASKS NUMBER(1) DEFAULT 0 NOT NULL CHECK (PERM_READTASKS IN (0,1));
UPDATE WORKBASKET_ACCESS_LIST
SET PERM_READTASKS=PERM_READ;
ALTER TABLE WORKBASKET_ACCESS_LIST
    ALTER PERM_READTASKS DROP DEFAULT;

ALTER TABLE WORKBASKET_ACCESS_LIST
    ADD PERM_EDITTASKS NUMBER(1) DEFAULT 0 NOT NULL CHECK (PERM_EDITTASKS IN (0,1));
UPDATE WORKBASKET_ACCESS_LIST
SET PERM_EDITTASKS=PERM_READ;
ALTER TABLE WORKBASKET_ACCESS_LIST
    ALTER PERM_EDITTASKS DROP DEFAULT
