The Flyway command-line tool is meant for users who
flyway-commandline-4.2.0-windows-x64.zip
flyway-commandline-4.2.0-macosx-x64.tar.gz
or for Homebrew users:
$ brew install flyway
flyway-commandline-4.2.0-linux-x64.tar.gz
| Distributions | Source |
|---|---|
|
flyway-commandline-4.2.0.zip (without JRE) flyway-commandline-4.2.0.tar.gz (without JRE) |
flyway-commandline-4.2.0-sources.jar |
> flyway [options] command
| 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 |
Flyway ships with JDBC drivers for the following databases by default:
If your database is not listed here, you need to manually place your JDBC driver in the drivers directory.
The Flyway Command-line tool can be configured in the following ways:
Flyway will search for and load configuration files in the following order:
(settings configured in later ones override those configured in earlier ones)
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
> flyway -user=myuser -schemas=schema1,schema2 -placeholders.keyABC=valueXYZ migrate
Command-line parameters override Configuration files
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 can suppress prompting by adding the -n flag.
All debug, info and warning output is sent to stdout. All errors are sent to stderr.
Adding -X to the argument list to also print debug output.
Add -q to the argument list to suppress all output, except for errors and warnings.
