diff --git a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/src/test/java/org/acme/deals/DealsRestIT.java b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/src/test/java/org/acme/deals/DealsRestIT.java index 063694e427..0166996378 100644 --- a/kogito-quarkus-examples/process-postgresql-persistence-quarkus/src/test/java/org/acme/deals/DealsRestIT.java +++ b/kogito-quarkus-examples/process-postgresql-persistence-quarkus/src/test/java/org/acme/deals/DealsRestIT.java @@ -15,6 +15,8 @@ */ package org.acme.deals; +import org.flywaydb.core.Flyway; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; @@ -30,6 +32,19 @@ @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) public class DealsRestIT { + private static final String QUARKUS_DATASOURCE_USERNAME = "quarkus.datasource.username"; + private static final String QUARKUS_DATASOURCE_PASSWORD = "quarkus.datasource.password"; + private static final String QUARKUS_DATASOURCE_URL = "quarkus.datasource.jdbc.url"; + + @BeforeAll + public static void initFlywaySchema() { + String username = System.getProperty(QUARKUS_DATASOURCE_USERNAME); + String password = System.getProperty(QUARKUS_DATASOURCE_PASSWORD); + String url = System.getProperty(QUARKUS_DATASOURCE_URL); + Flyway flyway = Flyway.configure().dataSource(url, username, password).load(); + flyway.migrate(); + } + @Test public void testDealsRest() { // test adding new deal diff --git a/kogito-springboot-examples/process-postgresql-persistence-springboot/src/main/resources/postgresql.properties b/kogito-springboot-examples/process-postgresql-persistence-springboot/src/main/resources/postgresql.properties index c64b3063fd..45d272e9fc 100644 --- a/kogito-springboot-examples/process-postgresql-persistence-springboot/src/main/resources/postgresql.properties +++ b/kogito-springboot-examples/process-postgresql-persistence-springboot/src/main/resources/postgresql.properties @@ -6,6 +6,7 @@ kogito.persistence.type=postgresql kogito.persistence.postgresql.connection.uri=postgresql://kogito-user:kogito-pass@localhost:5432/kogito #run create tables scripts during the application startup -kogito.persistence.auto.ddl=true +spring.flyway.enabled=true +spring.flyway.baseline-on-migrate=true