Ask Your Question
1

How can the relative path for Flyway be specified in a project built with Gradle?

asked 2023-07-01 22:32:37 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-07-01 22:47:01 +0000

qstack gravatar image

The relative path for Flyway in a Gradle project can be specified in the build.gradle file using the following steps:

  1. Add the Flyway Gradle plugin to the buildscript dependencies:
buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath "org.flywaydb:flyway-gradle-plugin:${flywayVersion}"
  }
}
  1. Apply the Flyway Gradle plugin and configure it with the desired settings:
apply plugin: "org.flywaydb.flyway"

flyway {
  url = "jdbc:postgresql://localhost:5432/mydb"
  user = "myuser"
  password = "mypass"
  locations = ["filesystem:./db/migrations"]
}

In this example, the locations property specifies that the migration scripts are located in the db/migrations directory relative to the project root. This can be customized to point to a different directory using a relative path.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-01 22:32:37 +0000

Seen: 13 times

Last updated: Jul 01 '23