Get the most out of Flyway v7 - Sign up for our webinar on the Redgate Hub ▶ Watch now

Locations

Description

Comma-separated list of locations to scan recursively for migrations. The location type is determined by its prefix.

Classpath

Unprefixed locations or locations starting with classpath: point to a package on the classpath and may contain both SQL and Java-based migrations. You must ensure the package is available on the classpath (see Adding to the classpath).

Filesystem

Locations starting with filesystem: point to a directory on the filesystem, may only contain SQL migrations and are only scanned recursively down non-hidden directories.

Amazon S3

Locations starting with s3: point to a bucket in AWS S3, may only contain SQL migrations, and are scanned recursively. They are in the format s3:<bucket>(/optionalfolder/subfolder). To use AWS S3, the AWS SDK v2 and dependencies must be included, and configured for your S3 account.

Flyway Community is limited to a maximum of 100 migrations in Amazon S3. Upgrade to Flyway Teams to allow unlimited migrations.

Google Cloud Storage

Flyway Teams

Locations starting with gcs: point to a bucket in Google Cloud Storage, may only contain SQL migrations, and are scanned recursively. They are in the format gcs:<bucket>(/optionalfolder/subfolder). To use GCS, the GCS library must be included, and the GCS environment variable GOOGLE_APPLICATION_CREDENTIALS must be set to the credentials file for the service account that has access to the bucket.

Wildcards

Locations can contain wildcards. This allows matching against a path pattern instead of a single path. Supported wildcards:

  • ** : Matches any 0 or more directories. (e.g. db/**/test will match db/version1.0/test, db/version2.0/test, db/development/version/1.0/test but not db/version1.0/release)
  • * : Matches any 0 or more non-separator characters. (e.g. db/release1.* will match db/release1.0, db/release1.1, db/release1.123 but not db/release2.0)
  • ? : Matches any 1 non-separator character. (e.g. db/release1.? will match db/release1.0, db/release1.1 but not db/release1.11)

Default

classpath:db/migration

Usage

Commandline

./flyway -locations="filesystem:./sql" info

Configuration File

flyway.locations=filesystem:./sql

Environment Variable

FLYWAY_LOCATIONS=filesystem:./sql

API

Flyway.configure()
    .locations("filesystem:./sql")
    .load()

Gradle

flyway {
    locations = ['filesystem:./sql']
}

Maven

<configuration>
    <locations>
        <location>filesystem:./sql</location>
    </locations>
</configuration>