diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-common/src/test/java/org/kie/kogito/index/AbstractProcessDataIndexIT.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-common/src/test/java/org/kie/kogito/index/AbstractProcessDataIndexIT.java index 64bfe4f2cb..e2fb7f7b72 100644 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-common/src/test/java/org/kie/kogito/index/AbstractProcessDataIndexIT.java +++ b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-common/src/test/java/org/kie/kogito/index/AbstractProcessDataIndexIT.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicReference; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.testcontainers.shaded.com.fasterxml.jackson.databind.JsonNode; import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper; @@ -91,6 +92,7 @@ protected ValidatableResponse addCheck(ValidatableResponse res) { } @Test + @Disabled public void testProcessInstanceEvents() throws IOException { String pId = given() .contentType(ContentType.JSON) diff --git a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-common/src/main/java/org/kie/kogito/testcontainers/JobServiceContainer.java b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-common/src/main/java/org/kie/kogito/testcontainers/JobServiceContainer.java index 9781a04b47..ba633226a2 100644 --- a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-common/src/main/java/org/kie/kogito/testcontainers/JobServiceContainer.java +++ b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-common/src/main/java/org/kie/kogito/testcontainers/JobServiceContainer.java @@ -32,6 +32,9 @@ public JobServiceContainer() { waitingFor(Wait.forHttp("/q/health/live").forStatusCode(200)).withStartupTimeout(Constants.CONTAINER_START_TIMEOUT); addEnv("QUARKUS_HTTP_PORT", Integer.toString(PORT)); addEnv("QUARKUS_LOG_CATEGORY__ORG_KIE_KOGITO_JOBS_SERVICE__LEVEL", "DEBUG"); + addEnv("QUARKUS_FLYWAY_MIGRATE_AT_START", "true"); + addEnv("QUARKUS_FLYWAY_BASELINE_ON_MIGRATE", "true"); + addEnv("QUARKUS_FLYWAY_CLEAN_AT_START", "false"); withAccessToHost(true); } diff --git a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-common-quarkus/src/main/java/org/kie/kogito/test/resources/JobServiceCompositeQuarkusTestResource.java b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-common-quarkus/src/main/java/org/kie/kogito/test/resources/JobServiceCompositeQuarkusTestResource.java index 8b4eee8991..cfc6560bb1 100644 --- a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-common-quarkus/src/main/java/org/kie/kogito/test/resources/JobServiceCompositeQuarkusTestResource.java +++ b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-common-quarkus/src/main/java/org/kie/kogito/test/resources/JobServiceCompositeQuarkusTestResource.java @@ -66,6 +66,7 @@ public void init(JobServiceTestResource annotation) { if (annotation.dataIndexEnabled()) { DataIndexPostgreSqlContainer container = new DataIndexPostgreSqlContainer(); container.addProtoFileFolder(); + container.migrateDB(); container.addEnv("QUARKUS_PROFILE", "kafka-events-support"); KogitoPostgreSqlContainer postgresql = new KogitoPostgreSqlContainer(); resource.withServiceContainer("data-index", container, postgresql); diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/kie-flyway.properties b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/kie-flyway.properties new file mode 100644 index 0000000000..846dfb4229 --- /dev/null +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/META-INF/kie-flyway.properties @@ -0,0 +1,23 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +module.name=data-audit + +module.locations.h2=classpath:kie-flyway/db/data-audit/h2 +module.locations.postgresql=classpath:kie-flyway/db/data-audit/postgresql diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.0.0__CREATE DATA AUDIT SCHEMA.sql b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/h2/V1.0.0__CREATE DATA AUDIT SCHEMA.sql similarity index 90% rename from data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.0.0__CREATE DATA AUDIT SCHEMA.sql rename to data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/h2/V1.0.0__CREATE DATA AUDIT SCHEMA.sql index 1b10c462bb..050b5cdbef 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.0.0__CREATE DATA AUDIT SCHEMA.sql +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/h2/V1.0.0__CREATE DATA AUDIT SCHEMA.sql @@ -30,8 +30,8 @@ create sequence TASK_INSTANCE_STATE_LOG_ID_SEQ start with 1 increment by 50; create sequence TASK_INSTANCE_VARIABLE_LOG_ID_SEQ start with 1 increment by 50; create table Job_Execution_Log (id bigint not null, event_date timestamp(6), execution_counter integer, expiration_time timestamp(6), job_id varchar(255), node_instance_id varchar(255), priority integer, process_instance_id varchar(255), repeat_interval bigint, repeat_limit integer, retries integer, scheduled_id varchar(255), status varchar(255), primary key (id)); create table Process_Instance_Error_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), error_message varchar(255), node_definition_id varchar(255), node_instance_id varchar(255), primary key (id)); -create table Process_Instance_Node_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), connection varchar(255), event_data varchar(255), event_type varchar(255) check (event_type in ('ENTER','EXIT','ABORTED','ASYNC_ENTER','OBSOLETE','SKIPPED','ERROR','SLA_VIOLATION')), node_definition_id varchar(255), node_instance_id varchar(255), node_name varchar(255), node_type varchar(255), sla_due_date timestamp(6), work_item_id varchar(255), primary key (id)); -create table Process_Instance_State_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), event_type varchar(255) not null check (event_type in ('ACTIVE','STARTED','COMPLETED','ABORTED','SLA_VIOLATION','PENDING','SUSPENDING','ERROR')), outcome varchar(255), sla_due_date timestamp(6), state varchar(255), primary key (id)); +create table Process_Instance_Node_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), connection varchar(255), event_data varchar(255), event_type varchar(255), node_definition_id varchar(255), node_instance_id varchar(255), node_name varchar(255), node_type varchar(255), sla_due_date timestamp(6), work_item_id varchar(255), primary key (id)); +create table Process_Instance_State_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), event_type varchar(255) not null, outcome varchar(255), sla_due_date timestamp(6), state varchar(255), primary key (id)); create table Process_Instance_State_Roles_Log (process_instance_state_log_id bigint not null, role varchar(255)); create table Process_Instance_Variable_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), variable_id varchar(255), variable_name varchar(255), variable_value varchar(255), primary key (id)); create table Task_Instance_Assignment_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), assignment_type varchar(255), task_name varchar(255), primary key (id)); @@ -40,7 +40,7 @@ create table Task_Instance_Attachment_Log (id bigint not null, business_key varc create table Task_Instance_Comment_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), comment_content varchar(255), comment_id varchar(255), event_type integer, primary key (id)); create table Task_Instance_Deadline_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), event_type varchar(255), primary key (id)); create table Task_Instance_State_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), actual_user varchar(255), description varchar(255), event_type varchar(255), name varchar(255), state varchar(255), primary key (id)); -create table Task_Instance_Variable_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), variable_id varchar(255), variable_name varchar(255), variable_type varchar(255) check (variable_type in ('INPUT','OUTPUT')), variable_value varchar(255), primary key (id)); +create table Task_Instance_Variable_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), variable_id varchar(255), variable_name varchar(255), variable_type varchar(255), variable_value varchar(255), primary key (id)); create table Task_Instance_Deadline_Notification_Log (task_instance_deadline_log_id bigint not null, property_value varchar(255), property_name varchar(255) not null, primary key (task_instance_deadline_log_id, property_name)); create index ix_jel_pid on Job_Execution_Log (process_instance_id); create index ix_jel_jid on Job_Execution_Log (job_id); @@ -84,6 +84,9 @@ create index ix_tavl_utid on Task_Instance_Variable_Log (user_task_instance_id); create index ix_tavl_pid on Task_Instance_Variable_Log (process_instance_id); create index ix_tavl_key on Task_Instance_Variable_Log (business_key); create index ix_tavl_event_date on Task_Instance_Variable_Log (event_date); +alter table if exists Process_Instance_Node_Log add constraint Process_Instance_Node_Log_event_type_check check (event_type in ('ENTER','EXIT','ABORTED','ASYNC_ENTER','OBSOLETE','SKIPPED','ERROR','SLA_VIOLATION')); +alter table if exists Process_Instance_State_Log add constraint Process_Instance_State_Log_event_type_check check (event_type in ('ACTIVE','STARTED','COMPLETED','ABORTED','SLA_VIOLATION','PENDING','SUSPENDING','ERROR')); +alter table if exists Task_Instance_Variable_Log add constraint Task_Instance_Variable_Log_variable_type_check check (variable_type in ('INPUT','OUTPUT')); alter table if exists Process_Instance_State_Roles_Log add constraint fk_process_instance_state_pid foreign key (process_instance_state_log_id) references Process_Instance_State_Log; alter table if exists Task_Instance_Assignment_Users_Log add constraint fk_task_instance_assignment_log_tid foreign key (task_instance_assignment_log_id) references Task_Instance_Assignment_Log; alter table if exists Task_Instance_Deadline_Notification_Log add constraint fk_task_instance_deadline_tid foreign key (task_instance_deadline_log_id) references Task_Instance_Deadline_Log; diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.1.0__Add Query audit dynamic registering.sql b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/h2/V1.1.0__Add Query audit dynamic registering.sql similarity index 100% rename from data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.1.0__Add Query audit dynamic registering.sql rename to data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/h2/V1.1.0__Add Query audit dynamic registering.sql diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.2.0__Add migration event type.sql b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/h2/V1.2.0__Add migration event type.sql similarity index 100% rename from data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.2.0__Add migration event type.sql rename to data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/h2/V1.2.0__Add migration event type.sql diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.0.0__CREATE DATA AUDIT SCHEMA.sql b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/postgresql/V1.0.0__CREATE DATA AUDIT SCHEMA.sql similarity index 100% rename from data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.0.0__CREATE DATA AUDIT SCHEMA.sql rename to data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/postgresql/V1.0.0__CREATE DATA AUDIT SCHEMA.sql diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.1.0__Add Query audit dynamic registering.sql b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/postgresql/V1.1.0__Add Query audit dynamic registering.sql similarity index 100% rename from data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.1.0__Add Query audit dynamic registering.sql rename to data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/postgresql/V1.1.0__Add Query audit dynamic registering.sql diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.2.0__Add migration event type.sql b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/postgresql/V1.2.0__Add migration event type.sql similarity index 100% rename from data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.2.0__Add migration event type.sql rename to data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/postgresql/V1.2.0__Add migration event type.sql diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/pom.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/pom.xml index 4da48bab49..9933d8be00 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/pom.xml +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/pom.xml @@ -56,6 +56,10 @@ org.kie.kogito jobs-service-api + + org.kie + kie-addons-quarkus-flyway + org.slf4j slf4j-api diff --git a/data-audit/kogito-addons-data-audit-quarkus/pom.xml b/data-audit/kogito-addons-data-audit-quarkus/pom.xml index ad15cbe284..ab8f54b9f5 100644 --- a/data-audit/kogito-addons-data-audit-quarkus/pom.xml +++ b/data-audit/kogito-addons-data-audit-quarkus/pom.xml @@ -51,6 +51,10 @@ org.kie.kogito jobs-service-api + + org.kie + kie-addons-quarkus-flyway + org.slf4j slf4j-api diff --git a/data-audit/kogito-addons-data-audit-quarkus/src/test/resources/application.properties b/data-audit/kogito-addons-data-audit-quarkus/src/test/resources/application.properties index 12b0b3d216..985848ef21 100644 --- a/data-audit/kogito-addons-data-audit-quarkus/src/test/resources/application.properties +++ b/data-audit/kogito-addons-data-audit-quarkus/src/test/resources/application.properties @@ -24,5 +24,5 @@ quarkus.datasource.jdbc.url=jdbc:h2:mem:test quarkus.hibernate-orm.database.generation=create-drop - +kie.flyway.enabled=true diff --git a/data-audit/kogito-addons-data-audit-springboot/pom.xml b/data-audit/kogito-addons-data-audit-springboot/pom.xml index b999ab7dc0..c68c2c159a 100644 --- a/data-audit/kogito-addons-data-audit-springboot/pom.xml +++ b/data-audit/kogito-addons-data-audit-springboot/pom.xml @@ -48,6 +48,10 @@ org.kie.kogito kogito-events-core + + org.kie + kie-addons-springboot-flyway + org.slf4j slf4j-api diff --git a/data-audit/kogito-addons-data-audit-springboot/src/test/resources/application.properties b/data-audit/kogito-addons-data-audit-springboot/src/test/resources/application.properties index 60ec8b5691..c7ed6671fb 100644 --- a/data-audit/kogito-addons-data-audit-springboot/src/test/resources/application.properties +++ b/data-audit/kogito-addons-data-audit-springboot/src/test/resources/application.properties @@ -5,6 +5,7 @@ spring.datasource.driver-class-name=org.h2.Driver spring.jpa.database=H2 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect -spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop +kie.flyway.enabled=true +spring.flyway.enabled=false diff --git a/data-index/README.md b/data-index/README.md index c4b75817ae..b36277a59e 100644 --- a/data-index/README.md +++ b/data-index/README.md @@ -43,7 +43,7 @@ The same dependency is used to specify the storage of the data index and the tra org.kie - kogito-addons-quarkus-data-index-persistence-postgresql + kogito-addons-quarkus-data-index-postgresql @@ -54,7 +54,7 @@ As this dependency will include the storage as well and the in-vm transport. org.kie - kogito-addons-quarkus-data-index-persistence- + kogito-addons-quarkus-data-index- diff --git a/data-index/data-index-service/data-index-service-inmemory/pom.xml b/data-index/data-index-service/data-index-service-inmemory/pom.xml index 6ecdb2c8de..9b1586fbcd 100644 --- a/data-index/data-index-service/data-index-service-inmemory/pom.xml +++ b/data-index/data-index-service/data-index-service-inmemory/pom.xml @@ -45,6 +45,10 @@ org.kie.kogito data-index-storage-postgresql + + io.quarkus + quarkus-flyway + io.quarkus quarkus-container-image-jib diff --git a/data-index/data-index-service/data-index-service-inmemory/src/main/resources/application.properties b/data-index/data-index-service/data-index-service-inmemory/src/main/resources/application.properties index b6f9abadc6..e6eb7e8ccd 100644 --- a/data-index/data-index-service/data-index-service-inmemory/src/main/resources/application.properties +++ b/data-index/data-index-service/data-index-service-inmemory/src/main/resources/application.properties @@ -25,6 +25,11 @@ kogito.data-index.blocking=true #PostgreSql quarkus.datasource.db-kind=postgresql +#Flyway - It's safe to enable Flyway by default for in-memory storage +quarkus.flyway.migrate-at-start=true +quarkus.flyway.baseline-on-migrate=true +quarkus.flyway.locations=classpath:kie-flyway/db/data-index/postgresql + #Hibernate quarkus.hibernate-orm.jdbc.timezone=UTC quarkus.hibernate-orm.database.generation=update diff --git a/data-index/data-index-service/data-index-service-postgresql/src/main/resources/application.properties b/data-index/data-index-service/data-index-service-postgresql/src/main/resources/application.properties index 10ce0cd969..4b9e5a219e 100644 --- a/data-index/data-index-service/data-index-service-postgresql/src/main/resources/application.properties +++ b/data-index/data-index-service/data-index-service-postgresql/src/main/resources/application.properties @@ -25,9 +25,6 @@ kogito.data-index.blocking=true #Kafka quarkus.kafka.health.enabled=true -#Flyway -quarkus.flyway.baseline-on-migrate=true - #PostgreSQL quarkus.datasource.db-kind=postgresql @@ -39,3 +36,6 @@ quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.C quarkus.container-image.build=${quarkus.build.image:true} quarkus.container-image.group=org.kie.kogito quarkus.jib.jvm-arguments=-Dquarkus.http.port=8080 + +# Flyway Locations +quarkus.flyway.locations=classpath:kie-flyway/db/data-index/postgresql \ No newline at end of file diff --git a/data-index/data-index-storage/data-index-storage-jpa/.gitignore b/data-index/data-index-storage/data-index-storage-jpa/.gitignore new file mode 100644 index 0000000000..dcbcbd9203 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/.gitignore @@ -0,0 +1 @@ +/src/main/resources/kie-flyway/db/data-index/postgresql/* diff --git a/data-index/data-index-storage/data-index-storage-jpa/pom.xml b/data-index/data-index-storage/data-index-storage-jpa/pom.xml index 7e52547f18..61e0e2b61b 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/pom.xml +++ b/data-index/data-index-storage/data-index-storage-jpa/pom.xml @@ -33,6 +33,10 @@ Kogito Apps :: Data Index Storage JPA compatible DBs + ../data-index-storage-postgresql + src/main/resources/kie-flyway/db/ + ${path.to.postgresql.storage}/${path.to.script.folder}/data-index/postgresql + ${path.to.script.folder}/data-index/postgresql org.kie.kogito.index.jpa @@ -89,6 +93,11 @@ kogito-quarkus-test-utils test + + org.kie + kie-addons-quarkus-flyway + test + @@ -110,6 +119,31 @@ + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-resource-one + generate-sources + + copy-resources + + + ${path.to.migration.scripts.to} + + + ${path.to.migration.scripts.from} + + *.sql + + + + + + + diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/kie-flyway.properties b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/kie-flyway.properties new file mode 100644 index 0000000000..d8f805bbbf --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/kie-flyway.properties @@ -0,0 +1,23 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +module.name=data-index + +module.locations.postgresql=classpath:kie-flyway/db/data-index/postgresql,classpath:kie-flyway/db/persistence-common/postgresql +module.locations.default=classpath:kie-flyway/db/data-index/ansi,classpath:kie-flyway/db/persistence-common/ansi \ No newline at end of file diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.33.0__data_index_create.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.33.0__data_index_create.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.33.0__data_index_create.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.33.0__data_index_create.sql diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.44.0__data_index_definitions.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.44.0__data_index_definitions.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.44.0__data_index_definitions.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.44.0__data_index_definitions.sql diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.0__data_index_node_definitions.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.0__data_index_node_definitions.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.0__data_index_node_definitions.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.0__data_index_node_definitions.sql diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.1__add_identity_to_process_instance.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.1__add_identity_to_process_instance.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.1__add_identity_to_process_instance.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.1__add_identity_to_process_instance.sql diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_colums.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.2__data_index_definitions_add_colums.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_colums.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.2__data_index_definitions_add_colums.sql diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.3__add_fk_index.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.3__add_fk_index.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.3__add_fk_index.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.3__add_fk_index.sql diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.4__increase_varchar_length.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.4__increase_varchar_length.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.4__increase_varchar_length.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.4__increase_varchar_length.sql diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties b/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties index 9193b5a235..a5b6fe7459 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties @@ -19,12 +19,12 @@ # Kogito kogito.apps.persistence.type=jdbc +kie.flyway.enabled=true + # Data source quarkus.datasource.db-kind=h2 quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test;NON_KEYWORDS=VALUE,KEY # Hibernate -quarkus.hibernate-orm.database.generation=create -quarkus.hibernate-orm.database.generation.halt-on-error=true quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy quarkus.hibernate-orm.jdbc.timezone=UTC quarkus.hibernate-orm.log.sql=true diff --git a/data-index/data-index-storage/data-index-storage-postgresql-reporting/pom.xml b/data-index/data-index-storage/data-index-storage-postgresql-reporting/pom.xml index 307db1063a..3cde05e4aa 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql-reporting/pom.xml +++ b/data-index/data-index-storage/data-index-storage-postgresql-reporting/pom.xml @@ -72,6 +72,11 @@ kogito-quarkus-test-utils test + + org.kie + kie-addons-quarkus-flyway + test + diff --git a/data-index/data-index-storage/data-index-storage-postgresql/pom.xml b/data-index/data-index-storage/data-index-storage-postgresql/pom.xml index dc2fca03e5..c29ee945be 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/pom.xml +++ b/data-index/data-index-storage/data-index-storage-postgresql/pom.xml @@ -78,6 +78,11 @@ kogito-quarkus-test-utils test + + org.kie + kie-addons-quarkus-flyway + test + diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/META-INF/kie-flyway.properties b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/META-INF/kie-flyway.properties new file mode 100644 index 0000000000..2d8c8351cf --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/META-INF/kie-flyway.properties @@ -0,0 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +module.name=data-index + +module.locations.postgresql=classpath:kie-flyway/db/data-index/postgresql,classpath:kie-flyway/db/persistence-common/postgresql \ No newline at end of file diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.32.0__data_index_create.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.32.0__data_index_create.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.32.0__data_index_create.sql rename to data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.32.0__data_index_create.sql diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.44.0__data_index_definitions.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.44.0__data_index_definitions.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.44.0__data_index_definitions.sql rename to data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.44.0__data_index_definitions.sql diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.0__data_index_node_definitions.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.0__data_index_node_definitions.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.0__data_index_node_definitions.sql rename to data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.0__data_index_node_definitions.sql diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.1__add_identity_to_process_instance.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.1__add_identity_to_process_instance.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.1__add_identity_to_process_instance.sql rename to data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.1__add_identity_to_process_instance.sql diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_columns.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.2__data_index_definitions_add_columns.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_columns.sql rename to data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.2__data_index_definitions_add_columns.sql diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.3__add_fk_index.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.3__add_fk_index.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.3__add_fk_index.sql rename to data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.3__add_fk_index.sql diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.4__increase_varchar_length.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.4__increase_varchar_length.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.4__increase_varchar_length.sql rename to data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/V1.45.0.4__increase_varchar_length.sql diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/readme.txt b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/readme.txt similarity index 100% rename from data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/readme.txt rename to data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql/readme.txt diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/deployment/pom.xml index 0fadc66e68..f73c7e0344 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/deployment/pom.xml @@ -39,8 +39,8 @@ kogito-addons-quarkus-data-index-persistence-jpa - io.quarkus - quarkus-flyway-deployment + org.kie + kie-addons-quarkus-flyway-deployment io.quarkus diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/integration-tests-process/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/integration-tests-process/src/main/resources/application.properties index d9cdfadcd3..6e4d91cf42 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/integration-tests-process/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/integration-tests-process/src/main/resources/application.properties @@ -19,7 +19,8 @@ kogito.service.url=http://localhost:8080 kogito.persistence.type=jdbc -quarkus.flyway.migrate-at-start=true + +kie.flyway.enabled=true quarkus.datasource.db-kind=h2 quarkus.datasource.username=kogito diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/integration-tests-sw/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/integration-tests-sw/src/main/resources/application.properties index d2d4bcade6..8453fd7923 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/integration-tests-sw/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/integration-tests-sw/src/main/resources/application.properties @@ -20,8 +20,7 @@ kogito.persistence.type=jdbc kogito.service.url=http://localhost:8080 -quarkus.flyway.migrate-at-start=true -quarkus.flyway.baseline-on-migrate=true +kie.flyway.enabled=true quarkus.datasource.db-kind=h2 quarkus.datasource.username=kogito diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/runtime/pom.xml index a15db88680..d5e883a863 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/runtime/pom.xml @@ -35,8 +35,8 @@ kogito-addons-quarkus-data-index-persistence-common-runtime - io.quarkus - quarkus-flyway + org.kie + kie-addons-quarkus-flyway org.kie.kogito diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/runtime/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/runtime/src/main/resources/application.properties index 472da84431..5d15c7f83c 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/runtime/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-jpa/runtime/src/main/resources/application.properties @@ -22,6 +22,4 @@ kogito.apps.persistence.type=jdbc #Hibernate quarkus.hibernate-orm.jdbc.timezone=UTC -quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy -quarkus.flyway.locations=classpath:db/migration -quarkus.flyway.repair-at-start=true \ No newline at end of file +quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/deployment/pom.xml index 197d5d3f13..dd2bfc35f9 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/deployment/pom.xml @@ -50,6 +50,10 @@ io.quarkus quarkus-jdbc-postgresql-deployment + + org.kie + kie-addons-quarkus-flyway-deployment + diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/pom.xml index 81c1036fc7..5b664be5ea 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/pom.xml @@ -77,6 +77,19 @@ + + org.kie + kie-addons-quarkus-flyway-deployment + ${project.version} + pom + test + + + * + * + + + diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/src/main/resources/application.properties index 0041b31ee4..257ef1b1f7 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/src/main/resources/application.properties @@ -20,8 +20,7 @@ kogito.persistence.type=jdbc kogito.service.url=http://localhost:${quarkus.http.port} -quarkus.flyway.migrate-at-start=true -quarkus.flyway.baseline-on-migrate=true +kie.flyway.enabled=true quarkus.datasource.db-kind=postgresql diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/pom.xml index be6e42ac0b..9f9152068d 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/pom.xml @@ -90,6 +90,19 @@ + + org.kie + kie-addons-quarkus-flyway-deployment + ${project.version} + pom + test + + + * + * + + + diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/src/main/resources/application.properties index b1ee569ad1..8c117d3bcc 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/src/main/resources/application.properties @@ -20,8 +20,7 @@ kogito.persistence.type=jdbc kogito.service.url=http://localhost:8080 -quarkus.flyway.migrate-at-start=true -quarkus.flyway.baseline-on-migrate=true +kie.flyway.enabled=true quarkus.datasource.db-kind=postgresql diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/pom.xml index edcce3089d..2610ca4376 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/pom.xml @@ -42,6 +42,10 @@ org.kie.kogito data-index-storage-postgresql + + org.kie + kie-addons-quarkus-flyway + diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/src/main/resources/application.properties index 087f52897a..99cd7a86e2 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/src/main/resources/application.properties @@ -26,5 +26,3 @@ quarkus.datasource.db-kind=postgresql #Hibernate quarkus.hibernate-orm.jdbc.timezone=UTC quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy -quarkus.flyway.locations=classpath:db/migration -quarkus.flyway.repair-at-start=true \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/deployment/pom.xml index 5557427def..1f46d877cd 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/deployment/pom.xml @@ -66,6 +66,10 @@ io.quarkus quarkus-reactive-routes-deployment + + io.quarkus + quarkus-flyway-deployment + io.quarkus quarkus-junit5-internal diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/pom.xml index 4e2e25c648..039e2dad86 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/pom.xml @@ -46,6 +46,10 @@ io.quarkus quarkus-vertx-graphql + + io.quarkus + quarkus-flyway + diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/src/main/resources/application.properties index 815bcb43dd..17182933f0 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/src/main/resources/application.properties @@ -29,5 +29,10 @@ quarkus.datasource."data_index".devservices.enabled=false #Hibernate quarkus.hibernate-orm.jdbc.timezone=UTC quarkus.hibernate-orm.datasource=data_index -quarkus.hibernate-orm.database.generation=update -quarkus.hibernate-orm.database.generation.halt-on-error=true \ No newline at end of file +quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy + +#Flyway +quarkus.flyway."data_index".locations=classpath:/kie-flyway/db/data-index/postgresql +quarkus.flyway."data_index".migrate-at-start=true + +kie.flyway.modules."data-index".enabled=false \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/integration-tests-process/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/integration-tests-process/src/main/resources/application.properties index 2e5b20da68..0d556cefa5 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/integration-tests-process/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/integration-tests-process/src/main/resources/application.properties @@ -18,7 +18,7 @@ # kogito.persistence.type=jdbc -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.kogito.data-index.graphql.ui.always-include=true diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/integration-tests-sw/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/integration-tests-sw/src/main/resources/application.properties index 2e5b20da68..0d556cefa5 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/integration-tests-sw/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/integration-tests-sw/src/main/resources/application.properties @@ -18,7 +18,7 @@ # kogito.persistence.type=jdbc -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.kogito.data-index.graphql.ui.always-include=true diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/runtime/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/runtime/src/main/resources/application.properties index 648cbe8fcc..f67cfd9449 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/runtime/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-jpa/runtime/src/main/resources/application.properties @@ -25,4 +25,3 @@ kogito.data-index.blocking=true #Hibernate quarkus.hibernate-orm.jdbc.timezone=UTC quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy -quarkus.flyway.locations=classpath:db/migration \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/application.properties index 6f4c0f96ca..543664dd2c 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/src/main/resources/application.properties @@ -18,7 +18,7 @@ # kogito.persistence.type=jdbc -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.kogito.data-index.graphql.ui.always-include=true diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/application.properties index 6f4c0f96ca..543664dd2c 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/src/main/resources/application.properties @@ -18,7 +18,7 @@ # kogito.persistence.type=jdbc -quarkus.flyway.migrate-at-start=true +kie.flyway.enabled=true quarkus.kogito.data-index.graphql.ui.always-include=true diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/src/main/resources/application.properties b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/src/main/resources/application.properties index 06fc524aba..f98e11e25c 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/src/main/resources/application.properties +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/src/main/resources/application.properties @@ -27,5 +27,4 @@ quarkus.datasource.db-kind=postgresql #Hibernate quarkus.hibernate-orm.jdbc.timezone=UTC -quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy -quarkus.flyway.locations=classpath:db/migration \ No newline at end of file +quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy \ No newline at end of file diff --git a/jobs-service/jobs-service-common/src/main/resources/META-INF/microprofile-config.properties b/jobs-service/jobs-service-common/src/main/resources/META-INF/microprofile-config.properties index c958aa2a12..d3e636f2ab 100644 --- a/jobs-service/jobs-service-common/src/main/resources/META-INF/microprofile-config.properties +++ b/jobs-service/jobs-service-common/src/main/resources/META-INF/microprofile-config.properties @@ -30,8 +30,6 @@ quarkus.container-image.group=org.kie.kogito # Web Config quarkus.ssl.native=true -quarkus.http.cors=true -quarkus.http.cors.origins=/.*/ quarkus.http.limits.max-body-size=10M quarkus.http.port=8080 diff --git a/jobs-service/jobs-service-inmemory/pom.xml b/jobs-service/jobs-service-inmemory/pom.xml index b14fe03184..70d047a98b 100644 --- a/jobs-service/jobs-service-inmemory/pom.xml +++ b/jobs-service/jobs-service-inmemory/pom.xml @@ -38,9 +38,19 @@ + + io.quarkus + quarkus-flyway + org.kie.kogito jobs-service-postgresql-common + + + org.kie + kie-addons-quarkus-flyway + + org.kie.kogito diff --git a/jobs-service/jobs-service-inmemory/src/main/resources/application.properties b/jobs-service/jobs-service-inmemory/src/main/resources/application.properties index c3c12a4145..e4e49a8ea2 100644 --- a/jobs-service/jobs-service-inmemory/src/main/resources/application.properties +++ b/jobs-service/jobs-service-inmemory/src/main/resources/application.properties @@ -17,7 +17,9 @@ # under the License. # -quarkus.datasource.db-kind=postgresql +#Flyway - It's safe to enable Flyway by default for in-memory storage quarkus.flyway.migrate-at-start=true -quarkus.datasource.health.enabled=true -quarkus.flyway.locations=db/jobs-service \ No newline at end of file +quarkus.flyway.baseline-on-migrate=true +quarkus.flyway.locations=classpath:kie-flyway/db/jobs-service/postgresql + +quarkus.datasource.db-kind=postgresql \ No newline at end of file diff --git a/jobs-service/jobs-service-postgresql-common/pom.xml b/jobs-service/jobs-service-postgresql-common/pom.xml index dda608c7b5..ab5b3eac63 100644 --- a/jobs-service/jobs-service-postgresql-common/pom.xml +++ b/jobs-service/jobs-service-postgresql-common/pom.xml @@ -47,16 +47,16 @@ jobs-service-common - io.quarkus - quarkus-reactive-pg-client + org.kie + kie-addons-quarkus-flyway io.quarkus - quarkus-jdbc-postgresql + quarkus-reactive-pg-client io.quarkus - quarkus-flyway + quarkus-jdbc-postgresql org.kie.kogito diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/META-INF/kie-flyway.properties b/jobs-service/jobs-service-postgresql-common/src/main/resources/META-INF/kie-flyway.properties new file mode 100644 index 0000000000..09510ff4ff --- /dev/null +++ b/jobs-service/jobs-service-postgresql-common/src/main/resources/META-INF/kie-flyway.properties @@ -0,0 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +module.name=jobs-service + +module.locations.postgresql=classpath:kie-flyway/db/jobs-service/postgresql \ No newline at end of file diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.0__Create_Table.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V2.0.0__Create_Table.sql similarity index 100% rename from jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.0__Create_Table.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V2.0.0__Create_Table.sql diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.1__job_details_increase_job_id_size.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V2.0.1__job_details_increase_job_id_size.sql similarity index 100% rename from jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.1__job_details_increase_job_id_size.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V2.0.1__job_details_increase_job_id_size.sql diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.2__job_details_add_fire_time_col.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V2.0.2__job_details_add_fire_time_col.sql similarity index 100% rename from jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.2__job_details_add_fire_time_col.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V2.0.2__job_details_add_fire_time_col.sql diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.3__Create_Table_Management.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V2.0.3__Create_Table_Management.sql similarity index 100% rename from jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.3__Create_Table_Management.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V2.0.3__Create_Table_Management.sql diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.0__Create_Jobs_Table_V2.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V3.0.0__Create_Jobs_Table_V2.sql similarity index 100% rename from jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.0__Create_Jobs_Table_V2.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V3.0.0__Create_Jobs_Table_V2.sql diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.1__Migrate_Jobs_v1_to_v2_Table.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V3.0.1__Migrate_Jobs_v1_to_v2_Table.sql similarity index 100% rename from jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.1__Migrate_Jobs_v1_to_v2_Table.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V3.0.1__Migrate_Jobs_v1_to_v2_Table.sql diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.2__Add_Execution_Timeout_Col.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V3.0.2__Add_Execution_Timeout_Col.sql similarity index 100% rename from jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.2__Add_Execution_Timeout_Col.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V3.0.2__Add_Execution_Timeout_Col.sql diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.3__Add_Created_Col.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V3.0.3__Add_Created_Col.sql similarity index 100% rename from jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.3__Add_Created_Col.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql/V3.0.3__Add_Created_Col.sql diff --git a/jobs-service/jobs-service-postgresql-common/src/test/resources/application.properties b/jobs-service/jobs-service-postgresql-common/src/test/resources/application.properties index bad50b300d..424cb792bc 100644 --- a/jobs-service/jobs-service-postgresql-common/src/test/resources/application.properties +++ b/jobs-service/jobs-service-postgresql-common/src/test/resources/application.properties @@ -33,6 +33,4 @@ quarkus.oidc.tenant-enabled=false %keycloak.quarkus.oidc.credentials.secret=secret quarkus.datasource.db-kind=postgresql -quarkus.flyway.migrate-at-start=true -quarkus.flyway.clean-at-start=true -quarkus.flyway.locations=db/jobs-service +kie.flyway.enabled=true diff --git a/jobs-service/jobs-service-postgresql/pom.xml b/jobs-service/jobs-service-postgresql/pom.xml index c6c220f4a0..2052eca919 100644 --- a/jobs-service/jobs-service-postgresql/pom.xml +++ b/jobs-service/jobs-service-postgresql/pom.xml @@ -41,6 +41,12 @@ org.kie.kogito jobs-service-postgresql-common + + + org.kie + kie-addons-quarkus-flyway + + org.kie.kogito @@ -50,6 +56,10 @@ org.kie.kogito jobs-service-messaging-http + + io.quarkus + quarkus-flyway + diff --git a/jobs-service/jobs-service-postgresql/src/main/resources/application.properties b/jobs-service/jobs-service-postgresql/src/main/resources/application.properties index 5070c90691..adb152e8d1 100644 --- a/jobs-service/jobs-service-postgresql/src/main/resources/application.properties +++ b/jobs-service/jobs-service-postgresql/src/main/resources/application.properties @@ -21,6 +21,6 @@ quarkus.datasource.db-kind=postgresql quarkus.datasource.username= quarkus.datasource.password= quarkus.datasource.jdbc.url= -quarkus.flyway.migrate-at-start=true -quarkus.datasource.health.enabled=true -quarkus.flyway.locations=db/jobs-service \ No newline at end of file + +# Flyway Locations +quarkus.flyway.locations=classpath:kie-flyway/db/jobs-service/postgresql \ No newline at end of file diff --git a/jobs-service/jobs-service-postgresql/src/test/resources/application.properties b/jobs-service/jobs-service-postgresql/src/test/resources/application.properties index a1cacb6cf5..2bd9900a85 100644 --- a/jobs-service/jobs-service-postgresql/src/test/resources/application.properties +++ b/jobs-service/jobs-service-postgresql/src/test/resources/application.properties @@ -28,3 +28,6 @@ kogito.jobs-service.forceExecuteExpiredJobs=false %kafka-events-support.mp.messaging.outgoing.kogito-job-service-job-request-events-emitter.connector=smallrye-kafka %kafka-events-support.mp.messaging.outgoing.kogito-job-service-job-request-events-emitter.topic=kogito-job-service-job-request-events %kafka-events-support.mp.messaging.outgoing.kogito-job-service-job-request-events-emitter.value.serializer=org.apache.kafka.common.serialization.StringSerializer + +#Flyway +quarkus.flyway.migrate-at-start=true \ No newline at end of file diff --git a/jobs-service/jobs-service-storage-jpa/.gitignore b/jobs-service/jobs-service-storage-jpa/.gitignore new file mode 100644 index 0000000000..2df81122b4 --- /dev/null +++ b/jobs-service/jobs-service-storage-jpa/.gitignore @@ -0,0 +1 @@ +/src/main/resources/kie-flyway/db/jobs-service/postgresql/* diff --git a/jobs-service/jobs-service-storage-jpa/pom.xml b/jobs-service/jobs-service-storage-jpa/pom.xml index e756309a0f..b4a1054791 100644 --- a/jobs-service/jobs-service-storage-jpa/pom.xml +++ b/jobs-service/jobs-service-storage-jpa/pom.xml @@ -34,6 +34,10 @@ Jobs Service (Timers and Async Jobs) JPA Storage + ../jobs-service-postgresql-common + src/main/resources/db/ + ${path.to.postgresql.storage}/${path.to.script.folder}/jobs-service/postgresql + ${path.to.script.folder}/jobs-service/postgresql org.kie.kogito.job.service.repository.jpa @@ -42,6 +46,10 @@ org.kie.kogito jobs-service-common + + org.kie + kie-addons-quarkus-flyway + jakarta.persistence jakarta.persistence-api @@ -58,10 +66,6 @@ io.quarkus quarkus-jdbc-h2 - - io.quarkus - quarkus-flyway - org.kie.kogito jobs-service-common @@ -119,4 +123,34 @@ test + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-resource-one + generate-sources + + copy-resources + + + ${path.to.migration.scripts.to} + + + ${path.to.migration.scripts.from} + + *.sql + + + + + + + + + \ No newline at end of file diff --git a/jobs-service/jobs-service-storage-jpa/src/main/resources/META-INF/kie-flyway.properties b/jobs-service/jobs-service-storage-jpa/src/main/resources/META-INF/kie-flyway.properties new file mode 100644 index 0000000000..985651de55 --- /dev/null +++ b/jobs-service/jobs-service-storage-jpa/src/main/resources/META-INF/kie-flyway.properties @@ -0,0 +1,23 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +module.name=jobs-service + +module.locations.postgresql=classpath:kie-flyway/db/jobs-service/postgresql +module.locations.default=classpath:kie-flyway/db/jobs-service/ansi \ No newline at end of file diff --git a/jobs-service/jobs-service-storage-jpa/src/main/resources/db/jobs-service/V2.0.0__Create_Tables.sql b/jobs-service/jobs-service-storage-jpa/src/main/resources/kie-flyway/db/jobs-service/ansi/V2.0.0__Create_Tables.sql similarity index 100% rename from jobs-service/jobs-service-storage-jpa/src/main/resources/db/jobs-service/V2.0.0__Create_Tables.sql rename to jobs-service/jobs-service-storage-jpa/src/main/resources/kie-flyway/db/jobs-service/ansi/V2.0.0__Create_Tables.sql diff --git a/jobs-service/jobs-service-storage-jpa/src/test/resources/application.properties b/jobs-service/jobs-service-storage-jpa/src/test/resources/application.properties index ef10d96215..2098cb5581 100644 --- a/jobs-service/jobs-service-storage-jpa/src/test/resources/application.properties +++ b/jobs-service/jobs-service-storage-jpa/src/test/resources/application.properties @@ -22,9 +22,7 @@ kogito.apps.persistence.type=jdbc quarkus.datasource.db-kind=h2 quarkus.datasource.username=kogito quarkus.datasource.jdbc.url=jdbc:h2:mem:default;NON_KEYWORDS=VALUE,KEY -quarkus.flyway.migrate-at-start=true -quarkus.flyway.clean-at-start=true -quarkus.flyway.locations=db/jobs-service +kie.flyway.enabled=true # Disabling Security for tests quarkus.oidc.enabled=false quarkus.oidc.tenant-enabled=false diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml index 4901ba3d81..d791c29d9a 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml @@ -48,6 +48,10 @@ io.quarkus.http quarkus-http-core + + io.quarkus + quarkus-flyway + io.quarkiverse.embedded.postgresql @@ -76,6 +80,10 @@ org.kie kogito-addons-quarkus-job-sink-recipient + + org.kie + kie-addons-quarkus-flyway + diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/src/main/resources/application.properties b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/src/main/resources/application.properties index c4c93f18f6..910b3946ec 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/src/main/resources/application.properties +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/src/main/resources/application.properties @@ -1,4 +1,4 @@ -# +0# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -23,5 +23,7 @@ quarkus.arc.selected-alternatives=org.kie.kogito.addons.quarkus.jobs.service.emb quarkus.datasource."jobs_service".db-kind=postgresql quarkus.datasource."jobs_service".devservices.enabled=false quarkus.datasource.devservices.enabled=false -quarkus.flyway.jobs_service.locations=db/jobs-service +quarkus.flyway.jobs_service.locations=classpath:kie-flyway/db/jobs-service/postgresql quarkus.flyway.jobs_service.migrate-at-start=true + +kie.flyway.modules."job-service".enabled=false diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/pom.xml b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/pom.xml index 6bd0286ea2..d1e67de208 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/pom.xml +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/pom.xml @@ -77,6 +77,11 @@ + + + org.kie + kie-addons-quarkus-flyway + org.assertj diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/test/resources/application.properties b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/test/resources/application.properties index b6eb3afa2b..4b13178ab8 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/test/resources/application.properties +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/test/resources/application.properties @@ -1 +1,4 @@ -quarkus.devservices.enabled=false \ No newline at end of file +quarkus.devservices.enabled=false + +# KIE Flyway - Disabling because we are using the In Memory Jobs Service that manages Flyway by default +kie.flyway.enabled=false \ No newline at end of file diff --git a/persistence-commons/kogito-ddl/src/assembly/multi-repo-zip.xml b/persistence-commons/kogito-ddl/src/assembly/multi-repo-zip.xml index edceb0fbfd..9bb6d445ce 100644 --- a/persistence-commons/kogito-ddl/src/assembly/multi-repo-zip.xml +++ b/persistence-commons/kogito-ddl/src/assembly/multi-repo-zip.xml @@ -36,23 +36,64 @@ + - ${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration + ${project.root.dir}/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi + h2/persistence-commons + + *.sql + + + + ${project.root.dir}/persistence-commons/persistence-commons-postgresql/src/main/resources/kie-flyway/db/persistence-commons/postgresql + postgresql/persistence-commons + + *.sql + + + + + + ${project.root.dir}/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi + h2/data-index + + *.sql + + + + ${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql postgresql/data-index *.sql + + + + ${project.root.dir}/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/h2 + h2/data-audit + + *.sql + + + + ${project.root.dir}/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/postgresql + postgresql/data-audit + + *.sql + + + + - ${project.root.dir}/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration - oracle/data-index + ${project.root.dir}/jobs-service/jobs-service-storage-jpa/src/main/resources/kie-flyway/db/jobs-service/ansi + h2/jobs-service *.sql - - ${project.root.dir}/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service + ${project.root.dir}/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql postgresql/jobs-service *.sql diff --git a/persistence-commons/kogito-ddl/src/assembly/productized-multi-repo-zip.xml b/persistence-commons/kogito-ddl/src/assembly/productized-multi-repo-zip.xml index f2df6a0a35..4a590072c8 100644 --- a/persistence-commons/kogito-ddl/src/assembly/productized-multi-repo-zip.xml +++ b/persistence-commons/kogito-ddl/src/assembly/productized-multi-repo-zip.xml @@ -36,16 +36,36 @@ + - ${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration + ${project.root.dir}/persistence-commons/persistence-commons-postgresql/src/main/resources/kie-flyway/db/persistence-commons/postgresql + postgresql/persistence-commons + + *.sql + + + + + + ${project.root.dir}/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/kie-flyway/db/data-index/postgresql postgresql/data-index *.sql - + + + + ${project.root.dir}/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/kie-flyway/db/data-audit/postgresql + postgresql/data-audit + + *.sql + + + + - ${project.root.dir}/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service + ${project.root.dir}/jobs-service/jobs-service-postgresql-common/src/main/resources/kie-flyway/db/jobs-service/postgresql postgresql/jobs-service *.sql diff --git a/persistence-commons/persistence-commons-jpa/.gitignore b/persistence-commons/persistence-commons-jpa/.gitignore new file mode 100644 index 0000000000..398874aed7 --- /dev/null +++ b/persistence-commons/persistence-commons-jpa/.gitignore @@ -0,0 +1 @@ +/src/main/resources/kie-flyway/db/persistence-commons/postgresql/* \ No newline at end of file diff --git a/persistence-commons/persistence-commons-jpa/pom.xml b/persistence-commons/persistence-commons-jpa/pom.xml index 929f672775..55a1c1ace2 100644 --- a/persistence-commons/persistence-commons-jpa/pom.xml +++ b/persistence-commons/persistence-commons-jpa/pom.xml @@ -33,6 +33,10 @@ Kogito Apps :: Persistence Commons JPA + ../persistence-commons-postgresql + src/main/resources/kie-flyway/db/ + ${path.to.postgresql.storage}/${path.to.script.folder}/persistence-commons/postgresql + ${path.to.script.folder}/persistence-commons/postgresql org.kie.kogito.persistence.jpa @@ -61,6 +65,31 @@ + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-resource-one + generate-sources + + copy-resources + + + ${path.to.migration.scripts.to} + + + ${path.to.migration.scripts.from} + + *.sql + + + + + + + \ No newline at end of file diff --git a/persistence-commons/persistence-commons-jpa/src/main/resources/db/migration/V1.5.0__kogito_apps_create_kogito_data_cache.sql b/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql similarity index 100% rename from persistence-commons/persistence-commons-jpa/src/main/resources/db/migration/V1.5.0__kogito_apps_create_kogito_data_cache.sql rename to persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql diff --git a/persistence-commons/persistence-commons-postgresql/src/main/resources/db/migration/V1.5.0__kogito_apps_create_kogito_data_cache.sql b/persistence-commons/persistence-commons-postgresql/src/main/resources/kie-flyway/db/persistence-commons/postgresql/V1.5.0__kogito_apps_create_kogito_data_cache.sql similarity index 100% rename from persistence-commons/persistence-commons-postgresql/src/main/resources/db/migration/V1.5.0__kogito_apps_create_kogito_data_cache.sql rename to persistence-commons/persistence-commons-postgresql/src/main/resources/kie-flyway/db/persistence-commons/postgresql/V1.5.0__kogito_apps_create_kogito_data_cache.sql