From 14241b7353b226e0757308cd0f4b05292c8929a8 Mon Sep 17 00:00:00 2001 From: Imran Ali <101260174+justiceia@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:17:05 +0100 Subject: [PATCH] FACT-1766 bump flyway and postgresql (#2559) * git adding code to bump versions * updated other parts of build.gradle * added runtimeonly line * added postgresqlTransactionalLock to false * Fix int tests --------- Co-authored-by: Josh Blackmoor --- build.gradle | 12 ++++++++++-- .../sendletter/config/FlywayConfiguration.java | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index aed3b3ad2..9e55d3fa0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,19 @@ import org.flywaydb.gradle.task.FlywayMigrateTask +buildscript { + dependencies { + classpath("org.postgresql:postgresql:42.7.3") + classpath("org.flywaydb:flyway-database-postgresql:10.13.0") + } +} + plugins { id 'application' id 'checkstyle' id 'pmd' id 'jacoco' id 'io.spring.dependency-management' version '1.1.4' - id 'org.flywaydb.flyway' version '9.22.1' + id 'org.flywaydb.flyway' version '10.13.0' id 'org.springframework.boot' version '3.2.3' id 'org.owasp.dependencycheck' version '9.0.8' id 'com.github.ben-manes.versions' version '0.50.0' @@ -265,7 +272,8 @@ dependencies { implementation group: 'org.springframework.boot', name: 'spring-boot-starter-batch' implementation group: 'org.springframework.boot', name: 'spring-boot-configuration-processor' - implementation group: 'org.flywaydb', name: 'flyway-core', version: '8.5.13' + runtimeOnly group: 'org.flywaydb', name: 'flyway-database-postgresql', version: '10.13.0' + implementation group: 'org.flywaydb', name: 'flyway-core', version: '10.13.0' implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.3' implementation group: 'net.javacrumbs.shedlock', name: 'shedlock-provider-jdbc-template', version: '5.10.2' diff --git a/src/main/java/uk/gov/hmcts/reform/sendletter/config/FlywayConfiguration.java b/src/main/java/uk/gov/hmcts/reform/sendletter/config/FlywayConfiguration.java index 6525a140a..433977a0b 100644 --- a/src/main/java/uk/gov/hmcts/reform/sendletter/config/FlywayConfiguration.java +++ b/src/main/java/uk/gov/hmcts/reform/sendletter/config/FlywayConfiguration.java @@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; +import org.springframework.boot.autoconfigure.flyway.FlywayConfigurationCustomizer; import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; @@ -13,6 +14,8 @@ import org.springframework.context.annotation.Configuration; import uk.gov.hmcts.reform.sendletter.data.migration.FlywayNoOpStrategy; +import java.util.Map; + /** * Configuration for Flyway. */ @@ -45,4 +48,9 @@ public FlywayMigrationStrategy flywayMigrationStrategy() { public FlywayMigrationStrategy flywayVoidMigrationStrategy() { return null; } + + @Bean + public FlywayConfigurationCustomizer flywayCustomizer() { + return configuration -> configuration.configuration(Map.of("flyway.postgresql.transactional.lock", "false")); + } }