From 2c1a1070ec2c107c9c83f750f7d1eef9d7192503 Mon Sep 17 00:00:00 2001 From: David Benedeki <14905969+benedeki@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:04:57 +0200 Subject: [PATCH] #262: Full Flyway integration (#276) * #262: Full Flyway integration * numbered the SQL scripts for Flyway * changed `PartitioningForDB` class to contain `keysToValuesMap` instead of `keysToValues` according to validation * added sbt alias `testAll` for running all tests * database test for validation function moved to proper folder * set `flywayBaselineVersion` for upgrade purposes * README.md update --- .sbtrc | 3 + README.md | 12 ++- build.sbt | 1 + ....1.1__01_users.ddl => V0.1.0.1__users.ddl} | 0 ...tum_db.ddl => V0.1.0.2__atum_db_owner.ddl} | 0 ...dd_hstore.ddl => V0.2.0.0__add_hstore.ddl} | 0 .../V0.2.0.1__prepare_for_flyway_upgrade.sql | 25 ++++++ .../flow_patterns/{V1.4.1___.ddl => _.ddl} | 0 .../flows/{V1.3.1___.ddl => V0.1.0.40___.ddl} | 0 ...V1.3.2__flows.ddl => V0.1.0.41__flows.ddl} | 0 ...dl => V0.1.0.42__partitioning_to_flow.ddl} | 0 ...e_flow.sql => V0.2.0.51___create_flow.sql} | 0 ...ql => V0.2.0.52___add_to_parent_flows.sql} | 0 ...s.alter.ddl => V0.2.0.53__flows.alter.ddl} | 0 ...e_flow.sql => V0.2.0.54___create_flow.sql} | 0 ...update.sql => V0.2.0.55__flows.update.sql} | 0 ...s.alter.ddl => V0.2.0.56__flows.alter.ddl} | 0 ...ql => V0.2.0.57__get_flow_checkpoints.sql} | 0 ... => V0.2.0.58__get_flow_partitionings.sql} | 0 ...global_id.sql => V0.1.0.11__global_id.sql} | 3 +- ... V0.1.0.12__jsonb_array_to_text_array.sql} | 0 .../public/jsonb_array_to_text_array.sql | 39 ---------- .../runs/{V1.5.1___.ddl => V0.1.0.30.ddl} | 0 ...ata.ddl => V0.1.0.31__additional_data.ddl} | 0 ...kpoints.ddl => V0.1.0.32__checkpoints.ddl} | 0 ...ddl => V0.1.0.33__measure_definitions.ddl} | 0 ...ements.ddl => V0.1.0.34__measurements.ddl} | 0 ...nings.ddl => V0.1.0.35__partitionings.ddl} | 0 ...10__add_partitioning_check_constraint.sql} | 0 ...ql => V0.2.0.11___get_id_partitioning.sql} | 0 ....sql => V0.2.0.12___write_measurement.sql} | 0 ...13__create_partitioning_if_not_exists.sql} | 0 ...nt.sql => V0.2.0.14__write_checkpoint.sql} | 0 ... V0.2.0.15__get_partitioning_measures.sql} | 0 ....16__get_partitioning_additional_data.sql} | 0 ...=> V0.2.0.17__additional_data_history.ddl} | 0 ...l => V0.2.0.18__alter_additional_data.ddl} | 0 ....19___update_existing_additional_data.sql} | 0 ....20__create_or_update_additional_data.sql} | 0 ... V0.2.0.21__get_partitioning_measures.sql} | 0 ....22__get_partitioning_additional_data.sql} | 0 ....2.0.23__get_partitioning_checkpoints.sql} | 0 ...nt.sql => V0.2.0.24__write_checkpoint.sql} | 2 +- ....0.25__get_partitioning_checkpoint_v2.sql} | 2 +- ... => V0.2.0.26__get_partitioning_by_id.sql} | 0 ...0.27__get_partitioning_measures_by_id.sql} | 0 ....28__get_partitioning_additional_data.sql} | 2 +- ...sql => V0.2.0.29__create_partitioning.sql} | 0 ...V0.2.0.30__get_partitioning_main_flow.sql} | 2 +- ...ng.sql => V0.2.0.31__get_partitioning.sql} | 0 .../{V1.6.1___.ddl => V0.2.0.5___.ddl} | 0 ...ql => V0.2.0.6__validate_partitioning.sql} | 78 ++++++++++--------- ...ql => V0.2.0.7__is_partitioning_valid.sql} | 22 +++--- .../GetFlowCheckpointsIntegrationTests.scala | 2 +- ...GetFlowPartitioningsIntegrationTests.scala | 6 +- ...UpdateAdditionalDataIntegrationTests.scala | 2 +- ...titioningIfNotExistsIntegrationTests.scala | 4 +- .../CreatePartitioningIntegrationTests.scala | 4 +- ...ioningAdditionalDataIntegrationTests.scala | 6 +- ...ningAdditionalDataV2IntegrationTests.scala | 4 +- .../GetPartitioningByIdIntegrationTests.scala | 2 +- ...itioningCheckpointV2IntegrationTests.scala | 4 +- ...titioningCheckpointsIntegrationTests.scala | 2 +- .../GetPartitioningIntegrationTests.scala | 6 +- ...PartitioningMainFlowIntegrationTests.scala | 4 +- ...ioningMeasuresByIdV2IntegrationTests.scala | 2 +- ...PartitioningMeasuresIntegrationTests.scala | 6 +- ...istingAdditionalDataIntegrationTests.scala | 2 +- .../WriteCheckpointIntegrationTests.scala | 2 +- ...CheckpointOverloadedIntegrationTests.scala | 2 +- .../IsPartitioningValidIntegrationTests.scala | 8 +- ...ValidatePartitioningIntegrationTests.scala | 26 +++---- project/FlywayConfiguration.scala | 2 +- .../functions/GetFlowPartitionings.scala | 2 +- .../PartitioningRepositoryImpl.scala | 2 +- .../atum/server/model/PartitioningForDB.scala | 4 +- .../za/co/absa/atum/server/api/TestData.scala | 2 +- 77 files changed, 152 insertions(+), 145 deletions(-) rename database/src/main/postgres/{V1.1.1__01_users.ddl => V0.1.0.1__users.ddl} (100%) rename database/src/main/postgres/{V1.1.2__02_atum_db.ddl => V0.1.0.2__atum_db_owner.ddl} (100%) rename database/src/main/postgres/{V1.1.3__03_add_hstore.ddl => V0.2.0.0__add_hstore.ddl} (100%) create mode 100644 database/src/main/postgres/V0.2.0.1__prepare_for_flyway_upgrade.sql rename database/src/main/postgres/flow_patterns/{V1.4.1___.ddl => _.ddl} (100%) rename database/src/main/postgres/flows/{V1.3.1___.ddl => V0.1.0.40___.ddl} (100%) rename database/src/main/postgres/flows/{V1.3.2__flows.ddl => V0.1.0.41__flows.ddl} (100%) rename database/src/main/postgres/flows/{V1.3.3__partitioning_to_flow.ddl => V0.1.0.42__partitioning_to_flow.ddl} (100%) rename database/src/main/postgres/flows/{V1.3.4___create_flow.sql => V0.2.0.51___create_flow.sql} (100%) rename database/src/main/postgres/flows/{V1.3.5___add_to_parent_flows.sql => V0.2.0.52___add_to_parent_flows.sql} (100%) rename database/src/main/postgres/flows/{V1.7.1__flows.alter.ddl => V0.2.0.53__flows.alter.ddl} (100%) rename database/src/main/postgres/flows/{V1.7.2___create_flow.sql => V0.2.0.54___create_flow.sql} (100%) rename database/src/main/postgres/flows/{V1.7.3__flows.update.sql => V0.2.0.55__flows.update.sql} (100%) rename database/src/main/postgres/flows/{V1.7.4__flows.alter.ddl => V0.2.0.56__flows.alter.ddl} (100%) rename database/src/main/postgres/flows/{V1.9.1__get_flow_checkpoints.sql => V0.2.0.57__get_flow_checkpoints.sql} (100%) rename database/src/main/postgres/flows/{V1.9.8__get_flow_partitionings.sql => V0.2.0.58__get_flow_partitionings.sql} (100%) rename database/src/main/postgres/public/{V1.2.1__global_id.sql => V0.1.0.11__global_id.sql} (96%) rename database/src/main/postgres/public/{V1.2.2__jsonb_array_to_text_array.sql => V0.1.0.12__jsonb_array_to_text_array.sql} (100%) delete mode 100644 database/src/main/postgres/public/jsonb_array_to_text_array.sql rename database/src/main/postgres/runs/{V1.5.1___.ddl => V0.1.0.30.ddl} (100%) rename database/src/main/postgres/runs/{V1.5.2__additional_data.ddl => V0.1.0.31__additional_data.ddl} (100%) rename database/src/main/postgres/runs/{V1.5.3__checkpoints.ddl => V0.1.0.32__checkpoints.ddl} (100%) rename database/src/main/postgres/runs/{V1.5.4__measure_definitions.ddl => V0.1.0.33__measure_definitions.ddl} (100%) rename database/src/main/postgres/runs/{V1.5.5__measurements.ddl => V0.1.0.34__measurements.ddl} (100%) rename database/src/main/postgres/runs/{V1.5.6__partitionings.ddl => V0.1.0.35__partitionings.ddl} (100%) rename database/src/main/postgres/{validation/V1.6.4__add_partitioning_check_constraint.sql => runs/V0.2.0.10__add_partitioning_check_constraint.sql} (100%) rename database/src/main/postgres/runs/{V1.5.7___get_id_partitioning.sql => V0.2.0.11___get_id_partitioning.sql} (100%) rename database/src/main/postgres/runs/{V1.5.8___write_measurement.sql => V0.2.0.12___write_measurement.sql} (100%) rename database/src/main/postgres/runs/{V1.5.9__create_partitioning_if_not_exists.sql => V0.2.0.13__create_partitioning_if_not_exists.sql} (100%) rename database/src/main/postgres/runs/{V1.5.10__write_checkpoint.sql => V0.2.0.14__write_checkpoint.sql} (100%) rename database/src/main/postgres/runs/{V1.5.11__get_partitioning_measures.sql => V0.2.0.15__get_partitioning_measures.sql} (100%) rename database/src/main/postgres/runs/{V1.5.12__get_partitioning_additional_data.sql => V0.2.0.16__get_partitioning_additional_data.sql} (100%) rename database/src/main/postgres/runs/{V1.5.13__additional_data_history.ddl => V0.2.0.17__additional_data_history.ddl} (100%) rename database/src/main/postgres/runs/{V1.5.14__alter_additional_data.ddl => V0.2.0.18__alter_additional_data.ddl} (100%) rename database/src/main/postgres/runs/{V1.5.15___update_existing_additional_data.sql => V0.2.0.19___update_existing_additional_data.sql} (100%) rename database/src/main/postgres/runs/{V1.5.16__create_or_update_additional_data.sql => V0.2.0.20__create_or_update_additional_data.sql} (100%) rename database/src/main/postgres/runs/{V1.8.1__get_partitioning_measures.sql => V0.2.0.21__get_partitioning_measures.sql} (100%) rename database/src/main/postgres/runs/{V1.8.2__get_partitioning_additional_data.sql => V0.2.0.22__get_partitioning_additional_data.sql} (100%) rename database/src/main/postgres/runs/{V1.8.3__get_partitioning_checkpoints.sql => V0.2.0.23__get_partitioning_checkpoints.sql} (100%) rename database/src/main/postgres/runs/{V1.9.2__write_checkpoint.sql => V0.2.0.24__write_checkpoint.sql} (98%) rename database/src/main/postgres/runs/{V1.9.3__get_partitioning_checkpoint_v2.sql => V0.2.0.25__get_partitioning_checkpoint_v2.sql} (97%) rename database/src/main/postgres/runs/{V1.9.4__get_partitioning_by_id.sql => V0.2.0.26__get_partitioning_by_id.sql} (100%) rename database/src/main/postgres/runs/{V1.9.5__get_partitioning_measures_by_id.sql => V0.2.0.27__get_partitioning_measures_by_id.sql} (100%) rename database/src/main/postgres/runs/{V1.9.6__get_partitioning_additional_data.sql => V0.2.0.28__get_partitioning_additional_data.sql} (96%) rename database/src/main/postgres/runs/{V1.9.7__create_partitioning.sql => V0.2.0.29__create_partitioning.sql} (100%) rename database/src/main/postgres/runs/{V1.9.9__get_partitioning_main_flow.sql => V0.2.0.30__get_partitioning_main_flow.sql} (96%) rename database/src/main/postgres/runs/{V1.9.12__get_partitioning.sql => V0.2.0.31__get_partitioning.sql} (100%) rename database/src/main/postgres/validation/{V1.6.1___.ddl => V0.2.0.5___.ddl} (100%) rename database/src/main/postgres/validation/{V1.6.2__validate_partitioning.sql => V0.2.0.6__validate_partitioning.sql} (63%) rename database/src/main/postgres/validation/{V1.6.3__is_partitioning_valid.sql => V0.2.0.7__is_partitioning_valid.sql} (77%) rename database/src/test/scala/za/co/absa/atum/database/{runs => validation}/IsPartitioningValidIntegrationTests.scala (96%) rename database/src/test/scala/za/co/absa/atum/database/{runs => validation}/ValidatePartitioningIntegrationTests.scala (95%) diff --git a/.sbtrc b/.sbtrc index 0affbc5dd..12237cb88 100644 --- a/.sbtrc +++ b/.sbtrc @@ -27,3 +27,6 @@ alias testIT=; testOnly *IntegrationTests # Project specific aliases alias testDB=; project database; testOnly * + +# Run all tests +alias testAll=; testOnly * diff --git a/README.md b/README.md index e36a70a82..46dfc975b 100644 --- a/README.md +++ b/README.md @@ -181,22 +181,28 @@ See the commands configured in the `.sbtrc` [(link)](https://www.scala-sbt.org/1 ### Run Unit Tests Use the `test` command to execute all unit tests, skipping all other types of tests. -``` +```sbt sbt test ``` ### Run Integration Tests Use the `testIT` command to execute all Integration tests, skipping all other test types. -``` +```sbt sbt testIT ``` Use the `testDB` command to execute all Integration tests in `database` module, skipping all other tests and modules. - Hint: project custom command -``` +```sbt sbt testDB ``` +If you want to run all tests, use the following command. +- Hint: project custom command +```sbt +sbt testAll +``` + ## How to Release diff --git a/build.sbt b/build.sbt index 1a9f89ed5..0c2f6b1ee 100644 --- a/build.sbt +++ b/build.sbt @@ -41,6 +41,7 @@ flywayUser := FlywayConfiguration.flywayUser flywayPassword := FlywayConfiguration.flywayPassword flywayLocations := FlywayConfiguration.flywayLocations flywaySqlMigrationSuffixes := FlywayConfiguration.flywaySqlMigrationSuffixes +flywayBaselineVersion := FlywayConfiguration.flywayBaselineVersion libraryDependencies ++= flywayDependencies /** diff --git a/database/src/main/postgres/V1.1.1__01_users.ddl b/database/src/main/postgres/V0.1.0.1__users.ddl similarity index 100% rename from database/src/main/postgres/V1.1.1__01_users.ddl rename to database/src/main/postgres/V0.1.0.1__users.ddl diff --git a/database/src/main/postgres/V1.1.2__02_atum_db.ddl b/database/src/main/postgres/V0.1.0.2__atum_db_owner.ddl similarity index 100% rename from database/src/main/postgres/V1.1.2__02_atum_db.ddl rename to database/src/main/postgres/V0.1.0.2__atum_db_owner.ddl diff --git a/database/src/main/postgres/V1.1.3__03_add_hstore.ddl b/database/src/main/postgres/V0.2.0.0__add_hstore.ddl similarity index 100% rename from database/src/main/postgres/V1.1.3__03_add_hstore.ddl rename to database/src/main/postgres/V0.2.0.0__add_hstore.ddl diff --git a/database/src/main/postgres/V0.2.0.1__prepare_for_flyway_upgrade.sql b/database/src/main/postgres/V0.2.0.1__prepare_for_flyway_upgrade.sql new file mode 100644 index 000000000..eeac5c967 --- /dev/null +++ b/database/src/main/postgres/V0.2.0.1__prepare_for_flyway_upgrade.sql @@ -0,0 +1,25 @@ +/* + * Copyright 2021 ABSA Group Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +DROP FUNCTION IF EXISTS validation.is_partitioning_valid(JSONB, BOOL); +DROP FUNCTION IF EXISTS validation.validate_partitioning(JSONB, BOOL); + +DROP FUNCTION IF EXISTS runs._get_id_partitioning(jsonb, boolean); +DROP FUNCTION IF EXISTS runs._write_measurement(uuid, bigint, text, text[], jsonb, text); +DROP FUNCTION IF EXISTS runs.create_partitioning_if_not_exists(jsonb, text, jsonb); +DROP FUNCTION IF EXISTS runs.write_checkpoint(jsonb, uuid, text, timestamp with time zone, timestamp with time zone, jsonb[], boolean, text); + +DROP FUNCTION IF EXISTS flows._add_to_parent_flows(bigint, bigint, text); +DROP FUNCTION IF EXISTS flows._create_flow(bigint, text); diff --git a/database/src/main/postgres/flow_patterns/V1.4.1___.ddl b/database/src/main/postgres/flow_patterns/_.ddl similarity index 100% rename from database/src/main/postgres/flow_patterns/V1.4.1___.ddl rename to database/src/main/postgres/flow_patterns/_.ddl diff --git a/database/src/main/postgres/flows/V1.3.1___.ddl b/database/src/main/postgres/flows/V0.1.0.40___.ddl similarity index 100% rename from database/src/main/postgres/flows/V1.3.1___.ddl rename to database/src/main/postgres/flows/V0.1.0.40___.ddl diff --git a/database/src/main/postgres/flows/V1.3.2__flows.ddl b/database/src/main/postgres/flows/V0.1.0.41__flows.ddl similarity index 100% rename from database/src/main/postgres/flows/V1.3.2__flows.ddl rename to database/src/main/postgres/flows/V0.1.0.41__flows.ddl diff --git a/database/src/main/postgres/flows/V1.3.3__partitioning_to_flow.ddl b/database/src/main/postgres/flows/V0.1.0.42__partitioning_to_flow.ddl similarity index 100% rename from database/src/main/postgres/flows/V1.3.3__partitioning_to_flow.ddl rename to database/src/main/postgres/flows/V0.1.0.42__partitioning_to_flow.ddl diff --git a/database/src/main/postgres/flows/V1.3.4___create_flow.sql b/database/src/main/postgres/flows/V0.2.0.51___create_flow.sql similarity index 100% rename from database/src/main/postgres/flows/V1.3.4___create_flow.sql rename to database/src/main/postgres/flows/V0.2.0.51___create_flow.sql diff --git a/database/src/main/postgres/flows/V1.3.5___add_to_parent_flows.sql b/database/src/main/postgres/flows/V0.2.0.52___add_to_parent_flows.sql similarity index 100% rename from database/src/main/postgres/flows/V1.3.5___add_to_parent_flows.sql rename to database/src/main/postgres/flows/V0.2.0.52___add_to_parent_flows.sql diff --git a/database/src/main/postgres/flows/V1.7.1__flows.alter.ddl b/database/src/main/postgres/flows/V0.2.0.53__flows.alter.ddl similarity index 100% rename from database/src/main/postgres/flows/V1.7.1__flows.alter.ddl rename to database/src/main/postgres/flows/V0.2.0.53__flows.alter.ddl diff --git a/database/src/main/postgres/flows/V1.7.2___create_flow.sql b/database/src/main/postgres/flows/V0.2.0.54___create_flow.sql similarity index 100% rename from database/src/main/postgres/flows/V1.7.2___create_flow.sql rename to database/src/main/postgres/flows/V0.2.0.54___create_flow.sql diff --git a/database/src/main/postgres/flows/V1.7.3__flows.update.sql b/database/src/main/postgres/flows/V0.2.0.55__flows.update.sql similarity index 100% rename from database/src/main/postgres/flows/V1.7.3__flows.update.sql rename to database/src/main/postgres/flows/V0.2.0.55__flows.update.sql diff --git a/database/src/main/postgres/flows/V1.7.4__flows.alter.ddl b/database/src/main/postgres/flows/V0.2.0.56__flows.alter.ddl similarity index 100% rename from database/src/main/postgres/flows/V1.7.4__flows.alter.ddl rename to database/src/main/postgres/flows/V0.2.0.56__flows.alter.ddl diff --git a/database/src/main/postgres/flows/V1.9.1__get_flow_checkpoints.sql b/database/src/main/postgres/flows/V0.2.0.57__get_flow_checkpoints.sql similarity index 100% rename from database/src/main/postgres/flows/V1.9.1__get_flow_checkpoints.sql rename to database/src/main/postgres/flows/V0.2.0.57__get_flow_checkpoints.sql diff --git a/database/src/main/postgres/flows/V1.9.8__get_flow_partitionings.sql b/database/src/main/postgres/flows/V0.2.0.58__get_flow_partitionings.sql similarity index 100% rename from database/src/main/postgres/flows/V1.9.8__get_flow_partitionings.sql rename to database/src/main/postgres/flows/V0.2.0.58__get_flow_partitionings.sql diff --git a/database/src/main/postgres/public/V1.2.1__global_id.sql b/database/src/main/postgres/public/V0.1.0.11__global_id.sql similarity index 96% rename from database/src/main/postgres/public/V1.2.1__global_id.sql rename to database/src/main/postgres/public/V0.1.0.11__global_id.sql index cca526eed..3546092de 100644 --- a/database/src/main/postgres/public/V1.2.1__global_id.sql +++ b/database/src/main/postgres/public/V0.1.0.11__global_id.sql @@ -40,6 +40,7 @@ BEGIN RETURN nextval('global_id_seq'); END; $$ -LANGUAGE plpgsql VOLATILE SECURITY DEFINER; + LANGUAGE plpgsql VOLATILE SECURITY DEFINER; GRANT EXECUTE ON FUNCTION public.global_id() TO PUBLIC; + diff --git a/database/src/main/postgres/public/V1.2.2__jsonb_array_to_text_array.sql b/database/src/main/postgres/public/V0.1.0.12__jsonb_array_to_text_array.sql similarity index 100% rename from database/src/main/postgres/public/V1.2.2__jsonb_array_to_text_array.sql rename to database/src/main/postgres/public/V0.1.0.12__jsonb_array_to_text_array.sql diff --git a/database/src/main/postgres/public/jsonb_array_to_text_array.sql b/database/src/main/postgres/public/jsonb_array_to_text_array.sql deleted file mode 100644 index 1829ad4ac..000000000 --- a/database/src/main/postgres/public/jsonb_array_to_text_array.sql +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2021 ABSA Group Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -CREATE OR REPLACE FUNCTION public.jsonb_array_to_text_array( - IN i_json_array JSONB -) RETURNS text[] -------------------------------------------------------------------------------- --- --- Function: public.jsonb_array_to_text_array(1) --- Converts a JSONB array into a Postgres array --- Based on the answer in https://dba.stackexchange.com/questions/54283/how-to-turn-json-array-into-postgres-array?newreg=5b29b7ed90224c7e9624162a0b52e81f --- --- Parameters: --- i_json_array - JSON array --- --- Returns: --- Postgres array --- -------------------------------------------------------------------------------- - LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE -BEGIN ATOMIC -SELECT ARRAY(SELECT jsonb_array_elements_text(i_json_array)); -END; - - -GRANT EXECUTE ON FUNCTION public.jsonb_array_to_text_array(JSONB) TO public; diff --git a/database/src/main/postgres/runs/V1.5.1___.ddl b/database/src/main/postgres/runs/V0.1.0.30.ddl similarity index 100% rename from database/src/main/postgres/runs/V1.5.1___.ddl rename to database/src/main/postgres/runs/V0.1.0.30.ddl diff --git a/database/src/main/postgres/runs/V1.5.2__additional_data.ddl b/database/src/main/postgres/runs/V0.1.0.31__additional_data.ddl similarity index 100% rename from database/src/main/postgres/runs/V1.5.2__additional_data.ddl rename to database/src/main/postgres/runs/V0.1.0.31__additional_data.ddl diff --git a/database/src/main/postgres/runs/V1.5.3__checkpoints.ddl b/database/src/main/postgres/runs/V0.1.0.32__checkpoints.ddl similarity index 100% rename from database/src/main/postgres/runs/V1.5.3__checkpoints.ddl rename to database/src/main/postgres/runs/V0.1.0.32__checkpoints.ddl diff --git a/database/src/main/postgres/runs/V1.5.4__measure_definitions.ddl b/database/src/main/postgres/runs/V0.1.0.33__measure_definitions.ddl similarity index 100% rename from database/src/main/postgres/runs/V1.5.4__measure_definitions.ddl rename to database/src/main/postgres/runs/V0.1.0.33__measure_definitions.ddl diff --git a/database/src/main/postgres/runs/V1.5.5__measurements.ddl b/database/src/main/postgres/runs/V0.1.0.34__measurements.ddl similarity index 100% rename from database/src/main/postgres/runs/V1.5.5__measurements.ddl rename to database/src/main/postgres/runs/V0.1.0.34__measurements.ddl diff --git a/database/src/main/postgres/runs/V1.5.6__partitionings.ddl b/database/src/main/postgres/runs/V0.1.0.35__partitionings.ddl similarity index 100% rename from database/src/main/postgres/runs/V1.5.6__partitionings.ddl rename to database/src/main/postgres/runs/V0.1.0.35__partitionings.ddl diff --git a/database/src/main/postgres/validation/V1.6.4__add_partitioning_check_constraint.sql b/database/src/main/postgres/runs/V0.2.0.10__add_partitioning_check_constraint.sql similarity index 100% rename from database/src/main/postgres/validation/V1.6.4__add_partitioning_check_constraint.sql rename to database/src/main/postgres/runs/V0.2.0.10__add_partitioning_check_constraint.sql diff --git a/database/src/main/postgres/runs/V1.5.7___get_id_partitioning.sql b/database/src/main/postgres/runs/V0.2.0.11___get_id_partitioning.sql similarity index 100% rename from database/src/main/postgres/runs/V1.5.7___get_id_partitioning.sql rename to database/src/main/postgres/runs/V0.2.0.11___get_id_partitioning.sql diff --git a/database/src/main/postgres/runs/V1.5.8___write_measurement.sql b/database/src/main/postgres/runs/V0.2.0.12___write_measurement.sql similarity index 100% rename from database/src/main/postgres/runs/V1.5.8___write_measurement.sql rename to database/src/main/postgres/runs/V0.2.0.12___write_measurement.sql diff --git a/database/src/main/postgres/runs/V1.5.9__create_partitioning_if_not_exists.sql b/database/src/main/postgres/runs/V0.2.0.13__create_partitioning_if_not_exists.sql similarity index 100% rename from database/src/main/postgres/runs/V1.5.9__create_partitioning_if_not_exists.sql rename to database/src/main/postgres/runs/V0.2.0.13__create_partitioning_if_not_exists.sql diff --git a/database/src/main/postgres/runs/V1.5.10__write_checkpoint.sql b/database/src/main/postgres/runs/V0.2.0.14__write_checkpoint.sql similarity index 100% rename from database/src/main/postgres/runs/V1.5.10__write_checkpoint.sql rename to database/src/main/postgres/runs/V0.2.0.14__write_checkpoint.sql diff --git a/database/src/main/postgres/runs/V1.5.11__get_partitioning_measures.sql b/database/src/main/postgres/runs/V0.2.0.15__get_partitioning_measures.sql similarity index 100% rename from database/src/main/postgres/runs/V1.5.11__get_partitioning_measures.sql rename to database/src/main/postgres/runs/V0.2.0.15__get_partitioning_measures.sql diff --git a/database/src/main/postgres/runs/V1.5.12__get_partitioning_additional_data.sql b/database/src/main/postgres/runs/V0.2.0.16__get_partitioning_additional_data.sql similarity index 100% rename from database/src/main/postgres/runs/V1.5.12__get_partitioning_additional_data.sql rename to database/src/main/postgres/runs/V0.2.0.16__get_partitioning_additional_data.sql diff --git a/database/src/main/postgres/runs/V1.5.13__additional_data_history.ddl b/database/src/main/postgres/runs/V0.2.0.17__additional_data_history.ddl similarity index 100% rename from database/src/main/postgres/runs/V1.5.13__additional_data_history.ddl rename to database/src/main/postgres/runs/V0.2.0.17__additional_data_history.ddl diff --git a/database/src/main/postgres/runs/V1.5.14__alter_additional_data.ddl b/database/src/main/postgres/runs/V0.2.0.18__alter_additional_data.ddl similarity index 100% rename from database/src/main/postgres/runs/V1.5.14__alter_additional_data.ddl rename to database/src/main/postgres/runs/V0.2.0.18__alter_additional_data.ddl diff --git a/database/src/main/postgres/runs/V1.5.15___update_existing_additional_data.sql b/database/src/main/postgres/runs/V0.2.0.19___update_existing_additional_data.sql similarity index 100% rename from database/src/main/postgres/runs/V1.5.15___update_existing_additional_data.sql rename to database/src/main/postgres/runs/V0.2.0.19___update_existing_additional_data.sql diff --git a/database/src/main/postgres/runs/V1.5.16__create_or_update_additional_data.sql b/database/src/main/postgres/runs/V0.2.0.20__create_or_update_additional_data.sql similarity index 100% rename from database/src/main/postgres/runs/V1.5.16__create_or_update_additional_data.sql rename to database/src/main/postgres/runs/V0.2.0.20__create_or_update_additional_data.sql diff --git a/database/src/main/postgres/runs/V1.8.1__get_partitioning_measures.sql b/database/src/main/postgres/runs/V0.2.0.21__get_partitioning_measures.sql similarity index 100% rename from database/src/main/postgres/runs/V1.8.1__get_partitioning_measures.sql rename to database/src/main/postgres/runs/V0.2.0.21__get_partitioning_measures.sql diff --git a/database/src/main/postgres/runs/V1.8.2__get_partitioning_additional_data.sql b/database/src/main/postgres/runs/V0.2.0.22__get_partitioning_additional_data.sql similarity index 100% rename from database/src/main/postgres/runs/V1.8.2__get_partitioning_additional_data.sql rename to database/src/main/postgres/runs/V0.2.0.22__get_partitioning_additional_data.sql diff --git a/database/src/main/postgres/runs/V1.8.3__get_partitioning_checkpoints.sql b/database/src/main/postgres/runs/V0.2.0.23__get_partitioning_checkpoints.sql similarity index 100% rename from database/src/main/postgres/runs/V1.8.3__get_partitioning_checkpoints.sql rename to database/src/main/postgres/runs/V0.2.0.23__get_partitioning_checkpoints.sql diff --git a/database/src/main/postgres/runs/V1.9.2__write_checkpoint.sql b/database/src/main/postgres/runs/V0.2.0.24__write_checkpoint.sql similarity index 98% rename from database/src/main/postgres/runs/V1.9.2__write_checkpoint.sql rename to database/src/main/postgres/runs/V0.2.0.24__write_checkpoint.sql index df5dcc20c..e73fb89a3 100644 --- a/database/src/main/postgres/runs/V1.9.2__write_checkpoint.sql +++ b/database/src/main/postgres/runs/V0.2.0.24__write_checkpoint.sql @@ -26,7 +26,7 @@ CREATE OR REPLACE FUNCTION runs.write_checkpoint( OUT status_text TEXT ) RETURNS record AS $$ - ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- -- -- Function: runs.write_checkpoint(8) -- Creates a checkpoint and adds all the measurements that it consists of diff --git a/database/src/main/postgres/runs/V1.9.3__get_partitioning_checkpoint_v2.sql b/database/src/main/postgres/runs/V0.2.0.25__get_partitioning_checkpoint_v2.sql similarity index 97% rename from database/src/main/postgres/runs/V1.9.3__get_partitioning_checkpoint_v2.sql rename to database/src/main/postgres/runs/V0.2.0.25__get_partitioning_checkpoint_v2.sql index 4adcd809b..3a6e96f8d 100644 --- a/database/src/main/postgres/runs/V1.9.3__get_partitioning_checkpoint_v2.sql +++ b/database/src/main/postgres/runs/V0.2.0.25__get_partitioning_checkpoint_v2.sql @@ -30,7 +30,7 @@ CREATE OR REPLACE FUNCTION runs.get_partitioning_checkpoint_v2( ) RETURNS SETOF record AS $$ - ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- -- -- Function: runs.get_partitioning_checkpoint_v2(BIGINT, UUID) -- Retrieves a single checkpoint (measures and their measurement details) related to a diff --git a/database/src/main/postgres/runs/V1.9.4__get_partitioning_by_id.sql b/database/src/main/postgres/runs/V0.2.0.26__get_partitioning_by_id.sql similarity index 100% rename from database/src/main/postgres/runs/V1.9.4__get_partitioning_by_id.sql rename to database/src/main/postgres/runs/V0.2.0.26__get_partitioning_by_id.sql diff --git a/database/src/main/postgres/runs/V1.9.5__get_partitioning_measures_by_id.sql b/database/src/main/postgres/runs/V0.2.0.27__get_partitioning_measures_by_id.sql similarity index 100% rename from database/src/main/postgres/runs/V1.9.5__get_partitioning_measures_by_id.sql rename to database/src/main/postgres/runs/V0.2.0.27__get_partitioning_measures_by_id.sql diff --git a/database/src/main/postgres/runs/V1.9.6__get_partitioning_additional_data.sql b/database/src/main/postgres/runs/V0.2.0.28__get_partitioning_additional_data.sql similarity index 96% rename from database/src/main/postgres/runs/V1.9.6__get_partitioning_additional_data.sql rename to database/src/main/postgres/runs/V0.2.0.28__get_partitioning_additional_data.sql index cb3cf878d..6a42fdf2f 100644 --- a/database/src/main/postgres/runs/V1.9.6__get_partitioning_additional_data.sql +++ b/database/src/main/postgres/runs/V0.2.0.28__get_partitioning_additional_data.sql @@ -23,7 +23,7 @@ CREATE OR REPLACE FUNCTION runs.get_partitioning_additional_data( OUT ad_author TEXT ) RETURNS SETOF record AS $$ - ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- -- -- Function: runs.get_partitioning_additional_data(1) -- Returns additional data for the given partitioning diff --git a/database/src/main/postgres/runs/V1.9.7__create_partitioning.sql b/database/src/main/postgres/runs/V0.2.0.29__create_partitioning.sql similarity index 100% rename from database/src/main/postgres/runs/V1.9.7__create_partitioning.sql rename to database/src/main/postgres/runs/V0.2.0.29__create_partitioning.sql diff --git a/database/src/main/postgres/runs/V1.9.9__get_partitioning_main_flow.sql b/database/src/main/postgres/runs/V0.2.0.30__get_partitioning_main_flow.sql similarity index 96% rename from database/src/main/postgres/runs/V1.9.9__get_partitioning_main_flow.sql rename to database/src/main/postgres/runs/V0.2.0.30__get_partitioning_main_flow.sql index af41ad12c..2d62a2d45 100644 --- a/database/src/main/postgres/runs/V1.9.9__get_partitioning_main_flow.sql +++ b/database/src/main/postgres/runs/V0.2.0.30__get_partitioning_main_flow.sql @@ -24,7 +24,7 @@ CREATE OR REPLACE FUNCTION runs.get_partitioning_main_flow( OUT from_pattern BOOLEAN ) RETURNS record AS $$ - ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- -- -- Function: runs.get_partitioning_main_flow(1) -- Returns the main flow for the given partitioning diff --git a/database/src/main/postgres/runs/V1.9.12__get_partitioning.sql b/database/src/main/postgres/runs/V0.2.0.31__get_partitioning.sql similarity index 100% rename from database/src/main/postgres/runs/V1.9.12__get_partitioning.sql rename to database/src/main/postgres/runs/V0.2.0.31__get_partitioning.sql diff --git a/database/src/main/postgres/validation/V1.6.1___.ddl b/database/src/main/postgres/validation/V0.2.0.5___.ddl similarity index 100% rename from database/src/main/postgres/validation/V1.6.1___.ddl rename to database/src/main/postgres/validation/V0.2.0.5___.ddl diff --git a/database/src/main/postgres/validation/V1.6.2__validate_partitioning.sql b/database/src/main/postgres/validation/V0.2.0.6__validate_partitioning.sql similarity index 63% rename from database/src/main/postgres/validation/V1.6.2__validate_partitioning.sql rename to database/src/main/postgres/validation/V0.2.0.6__validate_partitioning.sql index 02fe28b6d..d69b1e3e5 100644 --- a/database/src/main/postgres/validation/V1.6.2__validate_partitioning.sql +++ b/database/src/main/postgres/validation/V0.2.0.6__validate_partitioning.sql @@ -15,8 +15,9 @@ */ CREATE OR REPLACE FUNCTION validation.validate_partitioning( - IN i_partitioning JSONB, - IN i_strict_check BOOLEAN = true + IN i_partitioning JSONB, + IN i_strict_check BOOLEAN = true, + OUT error_message TEXT ) RETURNS SETOF TEXT AS $$ ------------------------------------------------------------------------------- @@ -26,15 +27,15 @@ $$ -- The validation performs: -- 1) Correct structure of the input JSONB object -- 2) The list of keys in 'keys' is unique and doesn't have NULLs --- 3) (if i_strict_check = true) The keys in 'keys' and in 'keysToValues' correspond to each other --- 4) (if i_strict_check = true) The values in 'keysToValues' are non-null +-- 3) (if i_strict_check = true) The keys in 'keys' and in 'keysToValuesMap' correspond to each other +-- 4) (if i_strict_check = true) The values in 'keysToValuesMap' are non-null -- -- Parameters: -- i_partitioning - partitioning to validate, a valid example: -- { -- "keys": ["one", "two", "three"], -- "version": 1, --- "keysToValues": { +-- "keysToValuesMap": { -- "one": "DatasetA", -- "two": "Version1", -- "three": "2022-12-20" @@ -49,7 +50,7 @@ $$ -- ------------------------------------------------------------------------------- DECLARE - _mandatory_fields_in_input CONSTANT TEXT[] := ARRAY['keys', 'version', 'keysToValues']; + _mandatory_fields_in_input CONSTANT TEXT[] := ARRAY['keys', 'version', 'keysToValuesMap']; _all_fields_in_input TEXT[]; _is_input_properly_structured BOOL; @@ -70,22 +71,24 @@ BEGIN IF NOT _is_input_properly_structured THEN SELECT array_agg(X.keys) FROM ( - SELECT jsonb_object_keys(i_partitioning) AS keys - ) AS X + SELECT jsonb_object_keys(i_partitioning) AS keys + ) AS X INTO _all_fields_in_input; - RETURN NEXT - 'The input partitioning is not properly structured, it should have this structure: ' - || _mandatory_fields_in_input::TEXT - || ' but contains: ' - || _all_fields_in_input::TEXT; + error_message := + 'The input partitioning is not properly structured, it should have this structure: ' + || _mandatory_fields_in_input::TEXT + || ' but contains: ' + || _all_fields_in_input::TEXT; + RETURN NEXT; END IF; SELECT CAST(i_partitioning->>'version' AS INTEGER) INTO _version; IF _version != 1 THEN - RETURN NEXT 'The input partitioning is not of the supported version. Should be 1, but it is: ' || _version; + error_message := 'The input partitioning is not of the supported version. Should be 1, but it is: ' || _version; + RETURN NEXT; END IF; -- Checking whether the array 'keys' is valid, i.e. has unique, non-null elements. @@ -94,55 +97,58 @@ BEGIN SELECT array_agg(X.keys), count(1) FROM ( - SELECT DISTINCT(JAE.value) AS keys - FROM jsonb_array_elements_text(i_partitioning->'keys') AS JAE - WHERE JAE.value IS NOT NULL - ) AS X + SELECT DISTINCT(JAE.value) AS keys + FROM jsonb_array_elements_text(i_partitioning->'keys') AS JAE + WHERE JAE.value IS NOT NULL + ) AS X INTO _partitioning_keys_uniq_and_not_null, _partitioning_keys_uniq_and_not_null_cnt; IF _partitioning_keys_all_cnt != _partitioning_keys_uniq_and_not_null_cnt THEN - RETURN NEXT 'The input partitioning is invalid, the keys must be unique and can not contain NULLs: ' + error_message := 'The input partitioning is invalid, the keys must be unique and can not contain NULLs: ' || (i_partitioning->>'keys'); + RETURN NEXT; END IF; - -- Checking whether the map 'keysToValues' has the same keys as the 'keys' attribute. + -- Checking whether the map 'keysToValuesMap' has the same keys as the 'keys' attribute. IF i_strict_check THEN SELECT array_agg(X.keys) FROM ( - SELECT jsonb_object_keys(i_partitioning->'keysToValues') AS keys - ) AS X + SELECT jsonb_object_keys(i_partitioning->'keysToValuesMap') AS keys + ) AS X INTO _partitioning_keys_from_values_map; IF NOT ( (_partitioning_keys_from_values_map @> _partitioning_keys_uniq_and_not_null) - AND (_partitioning_keys_from_values_map <@ _partitioning_keys_uniq_and_not_null) - ) THEN - - RETURN NEXT - 'The input partitioning is invalid, the keys in ''keys'' and ''keysToValues'' do not correspond. ' - || 'Given in ''keysToValues'': ' - || _partitioning_keys_from_values_map::TEXT - || ' vs (probably expected from ''keys''): ' - || _partitioning_keys_uniq_and_not_null::TEXT; + AND (_partitioning_keys_from_values_map <@ _partitioning_keys_uniq_and_not_null) + ) THEN + + error_message := + 'The input partitioning is invalid, the keys in ''keys'' and ''keysToValuesMap'' do not correspond. ' + || 'Given in ''keysToValuesMap'': ' + || _partitioning_keys_from_values_map::TEXT + || ' vs (probably expected from ''keys''): ' + || _partitioning_keys_uniq_and_not_null::TEXT; + RETURN NEXT; END IF; END IF; - -- Checking the validity of values in the map 'keysToValues', + -- Checking the validity of values in the map 'keysToValuesMap', -- non-pattern-like partitioning can't have null values there. IF i_strict_check THEN PERFORM 1 - FROM jsonb_each_text(i_partitioning->'keysToValues') AS elem + FROM jsonb_each_text(i_partitioning->'keysToValuesMap') AS elem WHERE elem.value IS NULL; IF found THEN - RETURN NEXT 'The input partitioning is invalid, some values in ''keysToValues'' are NULLs: ' - || (i_partitioning->>'keysToValues'); + error_message := 'The input partitioning is invalid, some values in ''keysToValuesMap'' are NULLs: ' + || (i_partitioning->>'keysToValuesMap'); + RETURN NEXT; END IF; END IF; RETURN; END; $$ -LANGUAGE plpgsql IMMUTABLE SECURITY DEFINER; + LANGUAGE plpgsql IMMUTABLE SECURITY DEFINER; ALTER FUNCTION validation.validate_partitioning(JSONB, BOOL) OWNER TO atum_owner; diff --git a/database/src/main/postgres/validation/V1.6.3__is_partitioning_valid.sql b/database/src/main/postgres/validation/V0.2.0.7__is_partitioning_valid.sql similarity index 77% rename from database/src/main/postgres/validation/V1.6.3__is_partitioning_valid.sql rename to database/src/main/postgres/validation/V0.2.0.7__is_partitioning_valid.sql index 90a498b38..a505b1c7d 100644 --- a/database/src/main/postgres/validation/V1.6.3__is_partitioning_valid.sql +++ b/database/src/main/postgres/validation/V0.2.0.7__is_partitioning_valid.sql @@ -15,8 +15,9 @@ */ CREATE OR REPLACE FUNCTION validation.is_partitioning_valid( - IN i_partitioning JSONB, - IN i_strict_check BOOLEAN = true + IN i_partitioning JSONB, + IN i_strict_check BOOLEAN = true, + OUT is_valid BOOLEAN ) RETURNS BOOLEAN AS $$ ------------------------------------------------------------------------------- @@ -41,18 +42,21 @@ $$ -- ------------------------------------------------------------------------------- DECLARE - + _errors TEXT; + _count INTEGER; BEGIN - PERFORM validation.validate_partitioning(i_partitioning, i_strict_check) - LIMIT 1; + SELECT string_agg(VP.error_message, E',\n'), count(1) + FROM validation.validate_partitioning(i_partitioning, i_strict_check) VP + INTO _errors, _count; - IF found THEN - RAISE EXCEPTION 'The input partitioning is not valid: %', jsonb_pretty(i_partitioning); + IF _count > 0 THEN + RAISE EXCEPTION E'The input partitioning is not valid: %\nDue to issue(s):\n%', jsonb_pretty(i_partitioning), _errors ; END IF; - RETURN TRUE; + is_valid := TRUE; + RETURN; END; $$ -LANGUAGE plpgsql IMMUTABLE SECURITY DEFINER; + LANGUAGE plpgsql IMMUTABLE SECURITY DEFINER; ALTER FUNCTION validation.is_partitioning_valid(JSONB, BOOL) OWNER TO atum_owner; diff --git a/database/src/test/scala/za/co/absa/atum/database/flows/GetFlowCheckpointsIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/flows/GetFlowCheckpointsIntegrationTests.scala index ea9b7e6a1..9895eb994 100644 --- a/database/src/test/scala/za/co/absa/atum/database/flows/GetFlowCheckpointsIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/flows/GetFlowCheckpointsIntegrationTests.scala @@ -39,7 +39,7 @@ class GetFlowCheckpointsIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["keyX", "keyY", "keyZ"], - | "keysToValues": { + | "keysToValuesMap": { | "keyX": "value1", | "keyZ": "value3", | "keyY": "value2" diff --git a/database/src/test/scala/za/co/absa/atum/database/flows/GetFlowPartitioningsIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/flows/GetFlowPartitioningsIntegrationTests.scala index 904cd42b9..0a9745ce8 100644 --- a/database/src/test/scala/za/co/absa/atum/database/flows/GetFlowPartitioningsIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/flows/GetFlowPartitioningsIntegrationTests.scala @@ -34,7 +34,7 @@ class GetFlowPartitioningsIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["keyA", "keyB", "keyC"], - | "keysToValues": { + | "keysToValuesMap": { | "keyA": "valueA", | "keyB": "valueB", | "keyC": "valueC" @@ -48,7 +48,7 @@ class GetFlowPartitioningsIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["keyA", "keyB"], - | "keysToValues": { + | "keysToValuesMap": { | "keyA": "valueA", | "keyB": "valueB" | } @@ -61,7 +61,7 @@ class GetFlowPartitioningsIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["keyD", "keyE", "keyF"], - | "keysToValues": { + | "keysToValuesMap": { | "keyD": "valueD", | "keyE": "valueE", | "keyF": "valueF" diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/CreateOrUpdateAdditionalDataIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/CreateOrUpdateAdditionalDataIntegrationTests.scala index 32d8d679c..20ba3ffed 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/CreateOrUpdateAdditionalDataIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/CreateOrUpdateAdditionalDataIntegrationTests.scala @@ -29,7 +29,7 @@ class CreateOrUpdateAdditionalDataIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2", "key3"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2": "valueB", | "key3": "valueC" diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/CreatePartitioningIfNotExistsIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/CreatePartitioningIfNotExistsIntegrationTests.scala index 861cc7e6e..bf9f41130 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/CreatePartitioningIfNotExistsIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/CreatePartitioningIfNotExistsIntegrationTests.scala @@ -28,7 +28,7 @@ class CreatePartitioningIfNotExistsIntegrationTests extends DBTestSuite{ |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", @@ -43,7 +43,7 @@ class CreatePartitioningIfNotExistsIntegrationTests extends DBTestSuite{ |{ | "version": 1, | "keys": ["key1", "key3"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key3": "valueZ" | } diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/CreatePartitioningIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/CreatePartitioningIntegrationTests.scala index b9297d4a2..c31e83eb2 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/CreatePartitioningIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/CreatePartitioningIntegrationTests.scala @@ -28,7 +28,7 @@ class CreatePartitioningIntegrationTests extends DBTestSuite{ |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", @@ -43,7 +43,7 @@ class CreatePartitioningIntegrationTests extends DBTestSuite{ |{ | "version": 1, | "keys": ["key1", "key3"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key3": "valueZ" | } diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningAdditionalDataIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningAdditionalDataIntegrationTests.scala index 545f60328..a5dbd844d 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningAdditionalDataIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningAdditionalDataIntegrationTests.scala @@ -28,7 +28,7 @@ class GetPartitioningAdditionalDataIntegrationTests extends DBTestSuite{ |{ | "version": 1, | "keys": ["keyX", "keyY", "keyZ"], - | "keysToValues": { + | "keysToValuesMap": { | "keyX": "value1", | "keyZ": "value3", | "keyY": "value2" @@ -42,7 +42,7 @@ class GetPartitioningAdditionalDataIntegrationTests extends DBTestSuite{ |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", @@ -140,7 +140,7 @@ class GetPartitioningAdditionalDataIntegrationTests extends DBTestSuite{ |{ | "version": 1, | "keys": ["key1"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "value1" | } |} diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningAdditionalDataV2IntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningAdditionalDataV2IntegrationTests.scala index ca581a5e3..99082925f 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningAdditionalDataV2IntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningAdditionalDataV2IntegrationTests.scala @@ -28,7 +28,7 @@ class GetPartitioningAdditionalDataV2IntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["keyX", "keyY", "keyZ"], - | "keysToValues": { + | "keysToValuesMap": { | "keyX": "value1", | "keyZ": "value3", | "keyY": "value2" @@ -42,7 +42,7 @@ class GetPartitioningAdditionalDataV2IntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningByIdIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningByIdIntegrationTests.scala index bb296ab3d..a67bac508 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningByIdIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningByIdIntegrationTests.scala @@ -30,7 +30,7 @@ class GetPartitioningByIdIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningCheckpointV2IntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningCheckpointV2IntegrationTests.scala index 123dff16d..7d8777746 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningCheckpointV2IntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningCheckpointV2IntegrationTests.scala @@ -38,7 +38,7 @@ class GetPartitioningCheckpointV2IntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["keyX", "keyY", "keyZ"], - | "keysToValues": { + | "keysToValuesMap": { | "keyX": "value1", | "keyZ": "value3", | "keyY": "value2" @@ -52,7 +52,7 @@ class GetPartitioningCheckpointV2IntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningCheckpointsIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningCheckpointsIntegrationTests.scala index 21d623126..e0612b456 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningCheckpointsIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningCheckpointsIntegrationTests.scala @@ -38,7 +38,7 @@ class GetPartitioningCheckpointsIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["keyX", "keyY", "keyZ"], - | "keysToValues": { + | "keysToValuesMap": { | "keyX": "value1", | "keyZ": "value3", | "keyY": "value2" diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningIntegrationTests.scala index 6d2ac96ca..0296598a8 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningIntegrationTests.scala @@ -30,7 +30,7 @@ class GetPartitioningIntegrationTests extends DBTestSuite { |{ | "version":1, | "keys":["key1","key2","key3","key4"], - | "keysToValues":{ + | "keysToValuesMap":{ | "key1":"valueX", | "key2":"valueY", | "key3":"valueZ", @@ -46,7 +46,7 @@ class GetPartitioningIntegrationTests extends DBTestSuite { |{ | "version":1, | "keys":["key1","key2","key3","key4"], - | "keysToValues":{ + | "keysToValuesMap":{ | "key1":"valueX", | "key2":"valueX", | "key3":"valueX", @@ -91,7 +91,7 @@ class GetPartitioningIntegrationTests extends DBTestSuite { assert { val retrievedPartitioningAsJson = Json.fromString(row.getJsonB("o_partitioning").get.value) val expectedPartitioningAsJson = Json.fromString(partitioning1Value) - retrievedPartitioningAsJson \\ "keysToValues" == expectedPartitioningAsJson \\ "keysToValues" && + retrievedPartitioningAsJson \\ "keysToValuesMap" == expectedPartitioningAsJson \\ "keysToValuesMap" && retrievedPartitioningAsJson \\ "keys" == expectedPartitioningAsJson \\ "keys" } assert(row.getString("author").contains("Fantômas")) diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMainFlowIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMainFlowIntegrationTests.scala index ed2f9d5a0..2042cf146 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMainFlowIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMainFlowIntegrationTests.scala @@ -28,7 +28,7 @@ class GetPartitioningMainFlowIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["keyX", "keyY", "keyZ"], - | "keysToValues": { + | "keysToValuesMap": { | "keyX": "value1", | "keyZ": "value3", | "keyY": "value2" @@ -42,7 +42,7 @@ class GetPartitioningMainFlowIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMeasuresByIdV2IntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMeasuresByIdV2IntegrationTests.scala index 15e4fa75a..e9c998677 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMeasuresByIdV2IntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMeasuresByIdV2IntegrationTests.scala @@ -12,7 +12,7 @@ class GetPartitioningMeasuresByIdV2IntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMeasuresIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMeasuresIntegrationTests.scala index 8e587d7c6..12e1c64af 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMeasuresIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/GetPartitioningMeasuresIntegrationTests.scala @@ -29,7 +29,7 @@ class GetPartitioningMeasuresIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", @@ -91,7 +91,7 @@ class GetPartitioningMeasuresIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "value1" | } |} @@ -118,7 +118,7 @@ class GetPartitioningMeasuresIntegrationTests extends DBTestSuite { | "keyC" | ], | "version": 1, - | "keysToValues": { + | "keysToValuesMap": { | "keyA": "valueA", | "keyB": "valueB", | "keyC": "valueC" diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/UpdateExistingAdditionalDataIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/UpdateExistingAdditionalDataIntegrationTests.scala index d2cfd3f54..9480eded7 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/UpdateExistingAdditionalDataIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/UpdateExistingAdditionalDataIntegrationTests.scala @@ -29,7 +29,7 @@ class UpdateExistingAdditionalDataIntegrationTests extends DBTestSuite{ |{ | "version": 1, | "keys": ["key1", "key2", "key3"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ" diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/WriteCheckpointIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/WriteCheckpointIntegrationTests.scala index 30b02c8b8..6a0ef2813 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/WriteCheckpointIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/WriteCheckpointIntegrationTests.scala @@ -32,7 +32,7 @@ class WriteCheckpointIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/WriteCheckpointOverloadedIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/runs/WriteCheckpointOverloadedIntegrationTests.scala index 9975cacf1..611540cc7 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/WriteCheckpointOverloadedIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/runs/WriteCheckpointOverloadedIntegrationTests.scala @@ -32,7 +32,7 @@ class WriteCheckpointOverloadedIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key3", "key2", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": "valueZ", diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/IsPartitioningValidIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/validation/IsPartitioningValidIntegrationTests.scala similarity index 96% rename from database/src/test/scala/za/co/absa/atum/database/runs/IsPartitioningValidIntegrationTests.scala rename to database/src/test/scala/za/co/absa/atum/database/validation/IsPartitioningValidIntegrationTests.scala index 055fdede1..927b859e6 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/IsPartitioningValidIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/validation/IsPartitioningValidIntegrationTests.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package za.co.absa.atum.database.runs +package za.co.absa.atum.database.validation import org.postgresql.util.PSQLException import za.co.absa.balta.DBTestSuite @@ -29,7 +29,7 @@ class IsPartitioningValidIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2", "key3", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2": "valueB", | "key3": "valueC", @@ -44,7 +44,7 @@ class IsPartitioningValidIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2missing", "key3", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key3": "valueZ", | "key4": "valueA" @@ -59,7 +59,7 @@ class IsPartitioningValidIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2", "key3", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": null, diff --git a/database/src/test/scala/za/co/absa/atum/database/runs/ValidatePartitioningIntegrationTests.scala b/database/src/test/scala/za/co/absa/atum/database/validation/ValidatePartitioningIntegrationTests.scala similarity index 95% rename from database/src/test/scala/za/co/absa/atum/database/runs/ValidatePartitioningIntegrationTests.scala rename to database/src/test/scala/za/co/absa/atum/database/validation/ValidatePartitioningIntegrationTests.scala index d29b12e71..49929c506 100644 --- a/database/src/test/scala/za/co/absa/atum/database/runs/ValidatePartitioningIntegrationTests.scala +++ b/database/src/test/scala/za/co/absa/atum/database/validation/ValidatePartitioningIntegrationTests.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package za.co.absa.atum.database.runs +package za.co.absa.atum.database.validation import za.co.absa.balta.DBTestSuite import za.co.absa.balta.classes.JsonBString @@ -28,7 +28,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2", "key3"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2": "valueB", | "key3": "valueC" @@ -42,7 +42,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2 ", " key2", " "], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2 ": "valueB", | " key2": "valueC", @@ -57,7 +57,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2", "key3", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key2": "valueY", | "key3": null, @@ -72,7 +72,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2missing", "key3", "key4"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueX", | "key3": "valueZ", | "key4": "valueA" @@ -87,7 +87,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2", "key3"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2": "valueB", | "key4": "valueC" @@ -101,7 +101,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 999, | "keys": ["key1", "key2", "key3"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2": "valueB", | "key3": "valueC" @@ -115,7 +115,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2", "key3"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2": "valueB", | "key3": "valueC" @@ -143,7 +143,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 1, | "keys": ["key1", "key2", "key2"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2": "valueB" | } @@ -156,7 +156,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { |{ | "version": 999, | "keys": ["key1", "key2", "key2"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "valueA", | "key2": "valueB" | } @@ -189,7 +189,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { val row = queryResult.next() val errorDetails = row.resultSet.getString(1) - assert(errorDetails.startsWith("The input partitioning is invalid, some values in 'keysToValues' are NULLs:")) + assert(errorDetails.startsWith("The input partitioning is invalid, some values in 'keysToValuesMap' are NULLs:")) assert(!queryResult.hasNext) } } @@ -205,7 +205,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { assert( errorDetails.startsWith( - "The input partitioning is invalid, the keys in 'keys' and 'keysToValues' do not correspond." + "The input partitioning is invalid, the keys in 'keys' and 'keysToValuesMap' do not correspond." ) ) assert(!queryResult.hasNext) @@ -241,7 +241,7 @@ class ValidatePartitioningIntegrationTests extends DBTestSuite { assert( errorDetails.startsWith( - "The input partitioning is invalid, the keys in 'keys' and 'keysToValues' do not correspond." + "The input partitioning is invalid, the keys in 'keys' and 'keysToValuesMap' do not correspond." ) ) assert(!queryResult.hasNext) diff --git a/project/FlywayConfiguration.scala b/project/FlywayConfiguration.scala index 0b6b658a8..b3c995a67 100644 --- a/project/FlywayConfiguration.scala +++ b/project/FlywayConfiguration.scala @@ -24,5 +24,5 @@ object FlywayConfiguration { val flywayPassword = "postgres" val flywayLocations: Seq[String] = Seq("filesystem:database/src/main/postgres") val flywaySqlMigrationSuffixes: Seq[String] = Seq(".sql",".ddl") - + val flywayBaselineVersion = "0.1.0.42" } diff --git a/server/src/main/scala/za/co/absa/atum/server/api/database/flows/functions/GetFlowPartitionings.scala b/server/src/main/scala/za/co/absa/atum/server/api/database/flows/functions/GetFlowPartitionings.scala index 7e3555c9c..a5206ff3d 100644 --- a/server/src/main/scala/za/co/absa/atum/server/api/database/flows/functions/GetFlowPartitionings.scala +++ b/server/src/main/scala/za/co/absa/atum/server/api/database/flows/functions/GetFlowPartitionings.scala @@ -69,7 +69,7 @@ object GetFlowPartitionings { case Left(decodingFailure) => Left(decodingFailure) case Right(partitioningForDB) => val partitioningDTO = partitioningForDB.keys.map { key => - PartitionDTO(key, partitioningForDB.keysToValues(key)) + PartitionDTO(key, partitioningForDB.keysToValuesMap(key)) } resultsToPartitioningWithIdDTOs(tail, acc :+ PartitioningWithIdDTO(head.id, partitioningDTO, head.author)) } diff --git a/server/src/main/scala/za/co/absa/atum/server/api/repository/PartitioningRepositoryImpl.scala b/server/src/main/scala/za/co/absa/atum/server/api/repository/PartitioningRepositoryImpl.scala index 8ca576a35..1f2505375 100644 --- a/server/src/main/scala/za/co/absa/atum/server/api/repository/PartitioningRepositoryImpl.scala +++ b/server/src/main/scala/za/co/absa/atum/server/api/repository/PartitioningRepositoryImpl.scala @@ -128,7 +128,7 @@ class PartitioningRepositoryImpl ( error => ZIO.fail(GeneralDatabaseError(s"Failed to decode JSON: $error")), partitioningForDB => { val partitioningDTO: PartitioningDTO = partitioningForDB.keys.map { key => - PartitionDTO(key, partitioningForDB.keysToValues(key)) + PartitionDTO(key, partitioningForDB.keysToValuesMap(key)) } ZIO.succeed(PartitioningWithIdDTO(id, partitioningDTO, author)) } diff --git a/server/src/main/scala/za/co/absa/atum/server/model/PartitioningForDB.scala b/server/src/main/scala/za/co/absa/atum/server/model/PartitioningForDB.scala index 4b0132d13..4b55d3295 100644 --- a/server/src/main/scala/za/co/absa/atum/server/model/PartitioningForDB.scala +++ b/server/src/main/scala/za/co/absa/atum/server/model/PartitioningForDB.scala @@ -23,7 +23,7 @@ import za.co.absa.atum.model.dto.PartitioningDTO private[server] case class PartitioningForDB private ( version: Int = 1, keys: Seq[String], - keysToValues: Map[String, String] + keysToValuesMap: Map[String, String] ) object PartitioningForDB { @@ -32,7 +32,7 @@ object PartitioningForDB { val allKeys: Seq[String] = partitioning.map(_.key) val mapOfKeysAndValues: Map[String, String] = partitioning.map(p => p.key -> p.value).toMap - PartitioningForDB(keys = allKeys, keysToValues = mapOfKeysAndValues) + PartitioningForDB(keys = allKeys, keysToValuesMap = mapOfKeysAndValues) } implicit val encoder: Encoder[PartitioningForDB] = deriveEncoder diff --git a/server/src/test/scala/za/co/absa/atum/server/api/TestData.scala b/server/src/test/scala/za/co/absa/atum/server/api/TestData.scala index e36e0d615..7ac7ed79a 100644 --- a/server/src/test/scala/za/co/absa/atum/server/api/TestData.scala +++ b/server/src/test/scala/za/co/absa/atum/server/api/TestData.scala @@ -56,7 +56,7 @@ trait TestData { |{ | "version": 1, | "keys": ["key1", "key2"], - | "keysToValues": { + | "keysToValuesMap": { | "key1": "val1", | "key2": "val2" | }