Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #2637 - add update scripts from 8.1 to 8.2 #2639

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE SEQUENCE TASKANA_SCHEMA_VERSION_ID_SEQ

-- The VERSION value must be equal or higher then the value of TaskanaEngineImpl.MINIMAL_TASKANA_SCHEMA_VERSION
INSERT INTO TASKANA_SCHEMA_VERSION (ID, VERSION, CREATED)
VALUES (TASKANA_SCHEMA_VERSION_ID_SEQ.NEXTVAL, '7.0.0', CURRENT_TIMESTAMP);
VALUES (TASKANA_SCHEMA_VERSION_ID_SEQ.NEXTVAL, '7.1.0', CURRENT_TIMESTAMP);

CREATE TABLE CLASSIFICATION
(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- this script updates the TASKANA database schema from version 8.1.0. to version 8.2.0.
SET SCHEMA %schemaName%;

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

ALTER TABLE TASK
ADD COLUMN NUMBER_OF_COMMENTS INT DEFAULT 0;

UPDATE TASK t
SET NUMBER_OF_COMMENTS = subquery.COMMENT_COUNT
FROM (
SELECT t.ID, COUNT(tc.ID) AS COMMENT_COUNT
FROM TASK t
RIGHT OUTER JOIN TASK_COMMENT tc
ON t.ID = tc.TASK_ID
GROUP BY t.ID
) AS subquery
WHERE t.ID = subquery.ID;
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CREATE SEQUENCE TASKANA_SCHEMA_VERSION_ID_SEQ

-- The VERSION value must be equal or higher then the value of TaskanaEngineImpl.MINIMAL_TASKANA_SCHEMA_VERSION
INSERT INTO TASKANA_SCHEMA_VERSION (ID, VERSION, CREATED)
VALUES (nextval('TASKANA_SCHEMA_VERSION_ID_SEQ'), '7.0.0', CURRENT_TIMESTAMP);
VALUES (nextval('TASKANA_SCHEMA_VERSION_ID_SEQ'), '7.1.0', CURRENT_TIMESTAMP);

CREATE TABLE CLASSIFICATION
(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- this script updates the TASKANA database schema from version 8.1.0 to version 8.2.0.
SET SCHEMA %schemaName%;

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

ALTER TABLE TASK
ADD COLUMN NUMBER_OF_COMMENTS INT DEFAULT 0;

UPDATE TASK t
SET NUMBER_OF_COMMENTS = (
SELECT COUNT(tc.ID)
FROM TASK_COMMENT tc
WHERE tc.TASK_ID = t.ID
)
WHERE EXISTS (
SELECT 1
FROM TASK_COMMENT tc
WHERE tc.TASK_ID = t.ID
);
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CREATE SEQUENCE TASKANA_SCHEMA_VERSION_ID_SEQ

-- The VERSION value must be equal or higher then the value of TaskanaEngineImpl.MINIMAL_TASKANA_SCHEMA_VERSION
INSERT INTO TASKANA_SCHEMA_VERSION (ID, VERSION, CREATED)
VALUES (TASKANA_SCHEMA_VERSION_ID_SEQ.NEXTVAL, '7.0.0', CURRENT_TIMESTAMP);
VALUES (TASKANA_SCHEMA_VERSION_ID_SEQ.NEXTVAL, '7.1.0', CURRENT_TIMESTAMP);

CREATE TABLE CLASSIFICATION
(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- this script updates the TASKANA database schema from version 8.1.0 to version 8.2.0.
ALTER SESSION SET CURRENT_SCHEMA = %schemaName%;

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

ALTER TABLE TASK
ADD COLUMN NUMBER_OF_COMMENTS INT DEFAULT 0;

UPDATE TASK t
SET NUMBER_OF_COMMENTS = subquery.COMMENT_COUNT
FROM (
SELECT t.ID, COUNT(tc.ID) AS COMMENT_COUNT
FROM TASK t
RIGHT OUTER JOIN TASK_COMMENT tc
ON t.ID = tc.TASK_ID
GROUP BY t.ID
) AS subquery
WHERE t.ID = subquery.ID;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CREATE SEQUENCE TASKANA_SCHEMA_VERSION_ID_SEQ

-- The VERSION value must be equal or higher then the value of TaskanaEngineImpl.MINIMAL_TASKANA_SCHEMA_VERSION
INSERT INTO TASKANA_SCHEMA_VERSION (ID, VERSION, CREATED)
VALUES (nextval('TASKANA_SCHEMA_VERSION_ID_SEQ'), '7.0.0', CURRENT_TIMESTAMP);
VALUES (nextval('TASKANA_SCHEMA_VERSION_ID_SEQ'), '7.1.0', CURRENT_TIMESTAMP);

CREATE TABLE CLASSIFICATION
(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- this script updates the TASKANA database schema from version 8.1.0 to version 8.2.0.

SET search_path = %schemaName%;

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

ALTER TABLE TASK
ADD COLUMN NUMBER_OF_COMMENTS INT DEFAULT 0;

UPDATE TASK t
SET NUMBER_OF_COMMENTS = subquery.COMMENT_COUNT
FROM (
SELECT t.ID, COUNT(tc.ID) AS COMMENT_COUNT
FROM TASK t
RIGHT OUTER JOIN TASK_COMMENT tc
ON t.ID = tc.TASK_ID
GROUP BY t.ID
) AS subquery
WHERE t.ID = subquery.ID;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/** The TaskanaEngine represents an overall set of all needed services. */
public interface TaskanaEngine {
String MINIMAL_TASKANA_SCHEMA_VERSION = "7.0.0";
String MINIMAL_TASKANA_SCHEMA_VERSION = "7.1.0";

/**
* Returns a {@linkplain TaskService} initialized with the current TaskanaEngine. {@linkplain
Expand Down