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

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

ALTER TABLE WORKBASKET_ACCESS_LIST
    ADD COLUMN PERM_READTASKS BOOLEAN NOT NULL DEFAULT FALSE;
UPDATE WORKBASKET_ACCESS_LIST
SET PERM_READTASKS=PERM_READ;
ALTER TABLE WORKBASKET_ACCESS_LIST
    ALTER COLUMN PERM_READTASKS DROP DEFAULT;

ALTER TABLE WORKBASKET_ACCESS_LIST
    ADD COLUMN PERM_EDITTASKS BOOLEAN NOT NULL DEFAULT FALSE;
UPDATE WORKBASKET_ACCESS_LIST
SET PERM_EDITTASKS=PERM_READ;
ALTER TABLE WORKBASKET_ACCESS_LIST
    ALTER COLUMN PERM_EDITTASKS DROP DEFAULT;
