Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.