From a5e1001f1d7b1e941b482bc2e6ff9f4c53cf0db6 Mon Sep 17 00:00:00 2001 From: Tsvetomir Palashki Date: Fri, 5 Nov 2021 10:38:10 +0200 Subject: [PATCH 1/3] control-service: add last execution info to the data_job table As part of preparation for the implementation of the ability to filter and sort data jobs by their last execution status, time, and duration, add the respective columns to the data_job table. Testing done: Start the service and verify that the columns are created in the data_job table. Signed-off-by: Tsvetomir Palashki --- .../V20213110120000__add_last_execution_info_data_job.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql diff --git a/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql b/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql new file mode 100644 index 0000000000..4573933f50 --- /dev/null +++ b/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql @@ -0,0 +1,4 @@ +alter table data_job + add last_execution_status smallint, + add last_execution_end_time timestamp, + add last_execution_duration int; From 971d1ae63d21a233f1464c97ae438a664e1ea155 Mon Sep 17 00:00:00 2001 From: Tsvetomir Palashki Date: Fri, 5 Nov 2021 11:22:31 +0200 Subject: [PATCH 2/3] control-service: address review comments Signed-off-by: Tsvetomir Palashki --- .../V20213110120000__add_last_execution_info_data_job.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql b/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql index 4573933f50..882854c9c5 100644 --- a/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql +++ b/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql @@ -1,4 +1,4 @@ -alter table data_job - add last_execution_status smallint, - add last_execution_end_time timestamp, - add last_execution_duration int; +alter table if exists data_job + add column if not exists last_execution_status smallint, + add column if not exists last_execution_end_time timestamp, + add column if not exists last_execution_duration int; From 77a57968e07b3ecd0b15da16e0b8e99bc707deab Mon Sep 17 00:00:00 2001 From: Tsvetomir Palashki Date: Fri, 5 Nov 2021 17:08:51 +0200 Subject: [PATCH 3/3] control-service: add new columns one by one The H2 database used when running tests fails if the new three columns are added all at once. Change the flyway script to add the columns one by one. Testing done: running locally against an in-memory H2 database and verified that the script is run successfully. Signed-off-by: Tsvetomir Palashki --- .../V20213110120000__add_last_execution_info_data_job.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql b/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql index 882854c9c5..ccf358b805 100644 --- a/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql +++ b/projects/control-service/projects/pipelines_control_service/src/main/resources/db/migration/V20213110120000__add_last_execution_info_data_job.sql @@ -1,4 +1,6 @@ alter table if exists data_job - add column if not exists last_execution_status smallint, - add column if not exists last_execution_end_time timestamp, + add column if not exists last_execution_status smallint; +alter table if exists data_job + add column if not exists last_execution_end_time timestamp; +alter table if exists data_job add column if not exists last_execution_duration int;