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

Command-line tool

The Flyway command-line tool is meant for users who

  • do not run their applications on the JVM
  • wish to migrate their database from the command-line without having to install a build tool

Download

Windows

flyway-commandline-4.0.3-windows-x64.zip

 

Mac OSX

flyway-commandline-4.0.3-macosx-x64.tar.gz

or for Homebrew users:

$ brew install flyway

 

Linux

flyway-commandline-4.0.3-linux-x64.tar.gz

 

All platforms

Distributions Source
flyway-commandline-4.0.3.zip (without JRE)
flyway-commandline-4.0.3.tar.gz (without JRE)
flyway-commandline-4.0.3-sources.jar

Usage

> flyway [options] command

Commands

Name Description
migrate Migrates the database
clean Drops all objects in the configured schemas
info Prints the details and status information about all the migrations
validate Validates the applied migrations against the ones available on the classpath
baseline Baselines an existing database, excluding all migrations up to and including baselineVersion
repair Repairs the metadata table

JDBC drivers

Flyway ships with JDBC drivers for the following databases by default:

  • SQL Server (jTDS)
  • MySQL
  • MariaDB
  • PostgreSQL
  • Redshift
  • H2
  • Hsql
  • Derby
  • SQLite

If your database is not listed here, you need to manually place your JDBC driver in the drivers directory.

Configuration

The Flyway Command-line tool can be configured in the following ways:

Configuration file

Flyway will search for and load configuration files in the following order:
(settings configured in later ones override those configured in earlier ones)

  • <install-dir>/conf/flyway.conf
  • <user-home>/flyway.conf
  • <current-dir>/flyway.conf

To use an alternative configuration file use -configFile=path/to/myAlternativeConfig.conf
To use an alternative configuration file encoding (default: UTF-8) use -configFileEncoding=ISO-8859-1

Configuration files have the following syntax:

# Settings are simple key-value pairs
flyway.key=value
# Single line comment start with a hash

# These are some example settings
flyway.url=jdbc:mydb://mydatabaseurl
flyway.schemas=schema1,schema2
flyway.placeholders.keyABC=valueXYZ

Command-line parameters

> flyway -user=myuser -schemas=schema1,schema2 -placeholders.keyABC=valueXYZ migrate

Overriding order

Command-line parameters override Configuration files

Credentials

If you do not supply a database user and password via any of the means above, you will be prompted to enter them:

Database user: myuser
Database password:

If you want Flyway to connect to your database without a user or password, you must still pass in empty values to avoid the prompt.

Output

All debug, info and warning output is sent to stdout. All errors are sent to stderr.

Debug output

Adding -X to the argument list to also print debug output.

Quiet mode

Add -q to the argument list to suppress all output, except for errors and warnings.

Directory structure

directory structure

Command-line: migrate