Want to deploy your JVM, Node.js and Go apps effortlessly to AWS? Try our service Boxfuse

Gradle Plugin

Supported Gradle Versions

  • Gradle 2.1 and newer

Installation

plugins {
    id "org.flywaydb.flyway" version "4.2.0"
}

Tasks

Name Description
flywayMigrate Migrates the database
flywayClean Drops all objects in the configured schemas
flywayInfo Prints the details and status information about all the migrations
flywayValidate Validates the applied migrations against the ones available on the classpath
flywayBaseline Baselines an existing database, excluding all migrations up to and including baselineVersion
flywayRepair Repairs the metadata table

Configuration

The Flyway Gradle plugin can be configured in the following ways:

Directly in the build script

flyway {
    url = 'jdbc:h2:mem:mydb'
    user = 'myUsr'
    password = 'mySecretPwd'
    schemas = ['schema1', 'schema2', 'schema3']
    placeholders = [
        'keyABC': 'valueXYZ',
        'otherplaceholder': 'value123'
    ]
}

Through Gradle properties

gradle -Pflyway.user=myUsr -Pflyway.schemas=schema1,schema2 -Pflyway.placeholders.keyABC=valXYZ

gradle.properties

flyway.user=myUser
flyway.password=mySecretPwd

# List are defined as comma-separated values
flyway.schemas=schema1,schema2,schema3

# Individual placeholders are prefixed by flyway.placeholders.
flyway.placeholders.keyABC=valueXYZ
flyway.placeholders.otherplaceholder=value123

build.gradle

project.ext['flyway.user']='myUsr'
project.ext['flyway.password']='mySecretPwd'
project.ext['flyway.schemas']='schema1,schema2,schema3'
project.ext['flyway.placeholders.keyABC']='valueXYZ'
project.ext['flyway.placeholders.otherplaceholder']='value123'

Through System properties

gradle -Dflyway.user=myUsr -Dflyway.schemas=schema1,schema2 -Dflyway.placeholders.keyABC=valXYZ

Overriding order

System properties override Gradle properties override Plugin configuration

Gradle: migrate