Orion
Orion

Reputation: 1

Sbt FlywayMigrate Command Hanging after Upgrading Flyway Sbt

After upgrading flyway-sbt from 7.4.0 to 9.22.0 the sbt flywayMigrate command now hangs, e.g. | => root / flywayMigrate {x}s . In our migration scripts, we are creating the indexes concurrently.

Versions: sbt: 1.6.0 jdk: 11.0.24 sbt-play: 2.8.8 scala-sbt: 2.12.15 flyway-play: 7.14.0

build.sbt:

import com.typesafe.config.ConfigFactory


lazy val root = (project in file("."))
  .enablePlugins(PlayScala, FlywayPlugin)
  .configs(ITest)
  .settings(inConfig(ITest)(Defaults.itSettings): _*)

lazy val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()

lazy val ITest = config("it") extend Test
scalaSource in ITest := baseDirectory.value / "/test-integration"
resourceDirectory in ITest := baseDirectory.value / "/test-integration/resources"

version := conf.getString("app.version")

scalaVersion := "2.12.15"
val akkaVersion = play.core.PlayVersion.akkaVersion


// Dependencies
libraryDependencies ++= Seq(
  guice,
  ws,
  "org.skinny-framework"        %% "skinny-orm"                   % "3.1.0"           withSources(),
  "org.scalikejdbc"             %% "scalikejdbc-play-initializer" % "2.8.0-scalikejdbc-3.5"withSources(),
  "org.scalikejdbc"             %% "scalikejdbc"                  % "3.3.1"           withSources(),
  "com.typesafe.play"           %% "play-slick"                   % "5.0.2"           withSources(),
  "com.auth0"                    % "java-jwt"                     % "3.2.0", // Don't update it! will have jackson conflict
  "org.scalatestplus.play"      %% "scalatestplus-play"           % "5.1.0"           % Test,
  "org.scalatestplus"           %% "mockito-5-12"                 % "3.2.19.0"        % Test,
  "org.mockito"                  % "mockito-all"                  % "1.10.19"         % Test,
  "com.amazonaws"                % "aws-java-sdk"                 % "1.11.313",
  "org.flywaydb"                %% "flyway-play"                  % "7.14.0",
  "org.postgresql"               % "postgresql"                   % "42.2.2",
  "com.chuusai"                 %% "shapeless"                    % "2.3.3",
  "org.typelevel"               %% "cats-core"                    % "1.1.0",
  "org.lyranthe.prometheus"     %% "client"                       % "0.9.0-M5",
  "io.split.client"              % "java-client"                  % "2.3.1",
  "com.segment.analytics.java"   % "analytics"                    % "2.1.0",
  "it.innove"                    % "play2-pdf"                    % "1.9.1",
  "org.webjars"                  % "swagger-ui"                   % "2.2.0",
  "com.fasterxml.jackson.module" %% "jackson-module-scala"        % "2.11.4",
  "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310"    % "2.11.4",
  "com.github.jasminb"             % "jsonapi-converter"          % "0.11",
  "de.leanovate.play-mockws"    %% "play-mockws"                  % "2.8.1"            % Test,
  "org.scalatest"                %% "scalatest"                   % "3.2.19"           % Test,
  "javax.xml.bind"               % "jaxb-api"                     % "2.3.1",
  "org.scala-lang"               % "scala-compiler"               % scalaVersion.value,
  "org.scala-lang"               % "scala-reflect"                % scalaVersion.value,
  "org.scala-lang"               % "scala-library"                % scalaVersion.value,
  "com.typesafe.play"            %% "play"                        % "2.8.8",
  "com.typesafe.play"            %% "play-guice"                  % "2.8.8",
  "com.typesafe.play"            %% "play-test"                   % "2.8.8"           % Test,
  "com.typesafe.akka"            %% "akka-testkit"                % akkaVersion       % Test,
  "com.typesafe.akka"            %% "akka-http"                   % "10.2.10"         % Test,
  "com.typesafe"                 %% "ssl-config-core"             % "0.4.3",
)

// https://github.com/playframework/playframework/blob/2.6.x/framework/project/Dependencies.scala#L11
dependencyOverrides ++= Seq(
  "com.typesafe.akka"           %% "akka-actor"                % akkaVersion      withSources(),
  "com.typesafe.akka"           %% "akka-stream"               % akkaVersion      withSources(),
  "com.google.guava"             % "guava"                     % "33.4.0-jre",
  "org.slf4j"                    % "slf4j-api"                 % "1.7.36",
  "org.bitbucket.b_c"            % "jose4j"                    % "0.9.6",
  "org.scala-lang.modules"      %% "scala-xml"                 % "2.1.0"
)

plugins.sbt

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8")

// workaround for missing static SLF4J binder for logback
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"

// Scala style plugin
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

// SBT coverage plugin
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")

// Flyway plugin
addSbtPlugin("com.github.sbt" % "flyway-sbt" % "9.22.0")

// SBT Dependency Graph plugin
addDependencyTreePlugin

// Play swagger Docs
addSbtPlugin("io.github.play-swagger" % "sbt-play-swagger" % "1.6.1")

Tried adding flyway.postgresql.transactional.lock = false to application.conf but not working

Upvotes: 0

Views: 58

Answers (1)

Matej Cerny
Matej Cerny

Reputation: 73

We use flyway directly, and the only option was to pass the parameter like this:

Flyway
  .configure()
  .configuration(java.util.Map.of("flyway.postgresql.transactional.lock", "false"))
  ...

Try to look if there's a way to override the plugin configuration in this way. ^^

Upvotes: 2

Related Questions