diff --git a/integration-tests/flyway/src/main/java/io/quarkus/it/flyway/FlywayFunctionalityResource.java b/integration-tests/flyway/src/main/java/io/quarkus/it/flyway/FlywayFunctionalityResource.java index 5c72b0b721dad..648c69c9c748c 100644 --- a/integration-tests/flyway/src/main/java/io/quarkus/it/flyway/FlywayFunctionalityResource.java +++ b/integration-tests/flyway/src/main/java/io/quarkus/it/flyway/FlywayFunctionalityResource.java @@ -71,7 +71,7 @@ public String returnInitSql() { @GET @Path("init-sql-result") public Integer returnInitSqlResult() { - return (Integer) entityManager.createNativeQuery("SELECT f_my_constant()") + return (Integer) entityManager.createNativeQuery("SELECT TEST_SCHEMA.f_my_constant()") .getSingleResult(); } diff --git a/integration-tests/flyway/src/main/resources/application.properties b/integration-tests/flyway/src/main/resources/application.properties index 01118fbc3f0cc..141e7e7b3149a 100644 --- a/integration-tests/flyway/src/main/resources/application.properties +++ b/integration-tests/flyway/src/main/resources/application.properties @@ -22,7 +22,7 @@ quarkus.flyway.placeholders.foo=bar quarkus.flyway.placeholders.title=REPLACED quarkus.flyway.placeholder-prefix=#[ quarkus.flyway.placeholder-suffix=] -quarkus.flyway.init-sql=CREATE SCHEMA IF NOT EXISTS TEST_SCHEMA;CREATE OR REPLACE FUNCTION f_my_constant() RETURNS integer LANGUAGE plpgsql as $func$ BEGIN return 100; END $func$; +quarkus.flyway.init-sql=CREATE SCHEMA IF NOT EXISTS TEST_SCHEMA;CREATE OR REPLACE FUNCTION TEST_SCHEMA.f_my_constant() RETURNS integer LANGUAGE plpgsql as $func$ BEGIN return 100; END $func$; quarkus.hibernate-orm.database.generation=validate # second Agroal config @@ -33,4 +33,4 @@ quarkus.flyway.second-datasource.locations=db/location3 quarkus.flyway.second-datasource.sql-migration-prefix=V quarkus.flyway.second-datasource.migrate-at-start=true quarkus.flyway.second-datasource.placeholders.mambo=poa - +quarkus.flyway.second-datasource.init-sql=CREATE SCHEMA IF NOT EXISTS TEST_SCHEMA; diff --git a/integration-tests/flyway/src/main/resources/db/location3/V1.0.0__Quarkus.sql b/integration-tests/flyway/src/main/resources/db/location3/V1.0.0__Quarkus.sql index fb341850919bf..3d9d44eed5768 100644 --- a/integration-tests/flyway/src/main/resources/db/location3/V1.0.0__Quarkus.sql +++ b/integration-tests/flyway/src/main/resources/db/location3/V1.0.0__Quarkus.sql @@ -1,7 +1,8 @@ -CREATE TABLE multiple_flyway_test + +CREATE TABLE TEST_SCHEMA.multiple_flyway_test ( id INT, name VARCHAR(255) ); -INSERT INTO multiple_flyway_test(id, name) +INSERT INTO TEST_SCHEMA.multiple_flyway_test(id, name) VALUES (1, 'Multiple flyway datasources should work seamlessly in JVM and native mode'); \ No newline at end of file diff --git a/integration-tests/flyway/src/main/resources/db/location3/afterMigrate.sql b/integration-tests/flyway/src/main/resources/db/location3/afterMigrate.sql index aa8276f50e4b4..b74fc6059ca59 100644 --- a/integration-tests/flyway/src/main/resources/db/location3/afterMigrate.sql +++ b/integration-tests/flyway/src/main/resources/db/location3/afterMigrate.sql @@ -1 +1 @@ -select count(1) from multiple_flyway_test; +select count(1) from TEST_SCHEMA.multiple_flyway_test; diff --git a/integration-tests/flyway/src/test/java/io/quarkus/it/flyway/FlywayFunctionalityTest.java b/integration-tests/flyway/src/test/java/io/quarkus/it/flyway/FlywayFunctionalityTest.java index 59bd504667ea8..aa58144597cfd 100644 --- a/integration-tests/flyway/src/test/java/io/quarkus/it/flyway/FlywayFunctionalityTest.java +++ b/integration-tests/flyway/src/test/java/io/quarkus/it/flyway/FlywayFunctionalityTest.java @@ -46,10 +46,10 @@ public void testPlaceholdersPrefixSuffix() { } @Test - @DisplayName("Returns whether the init-sql is CREATE SCHEMA IF NOT EXISTS TEST_SCHEMA;CREATE OR REPLACE FUNCTION f_my_constant() RETURNS integer LANGUAGE plpgsql as $func$ BEGIN return 100; END $func$; or not") + @DisplayName("Returns whether the init-sql is CREATE SCHEMA IF NOT EXISTS TEST_SCHEMA;CREATE OR REPLACE FUNCTION TEST_SCHEMA.f_my_constant() RETURNS integer LANGUAGE plpgsql as $func$ BEGIN return 100; END $func$; or not") public void testReturnInitSql() { when().get("/flyway/init-sql").then().body(is( - "CREATE SCHEMA IF NOT EXISTS TEST_SCHEMA;CREATE OR REPLACE FUNCTION f_my_constant() RETURNS integer LANGUAGE plpgsql as $func$ BEGIN return 100; END $func$;")); + "CREATE SCHEMA IF NOT EXISTS TEST_SCHEMA;CREATE OR REPLACE FUNCTION TEST_SCHEMA.f_my_constant() RETURNS integer LANGUAGE plpgsql as $func$ BEGIN return 100; END $func$;")); } @Test