krypted.com

Tiny Deathstars of Foulness

Flyway is a tool that allows you to perform version-controlled management of SQL schemas. You can download flyway at http://flywaydb.org. It doesn’t require a build, so once downloaded, drop it where you want it to live and you can just summon the binary in scripts. Once installed, the following is the basic structure of commands for Flyway:

flyway [options] command

By default, the configuration will be read from conf/flyway.conf.
Options passed from the command-line override the configuration.

Commands
========
migrate : Migrates the database
clean : Drops all objects in the configured schemas
info : Prints the information about applied, current and pending migrations
validate : Validates the applied migrations against the ones on the classpath
baseline : Baselines an existing database at the baselineVersion
repair : Repairs the metadata table

Options (Format: -key=value)
=======
driver : Fully qualified classname of the jdbc driver
url : Jdbc url to use to connect to the database
user : User to use to connect to the database
password : Password to use to connect to the database
schemas : Comma-separated list of the schemas managed by Flyway
table : Name of Flyway’s metadata table
locations : Classpath locations to scan recursively for migrations
resolvers : Comma-separated list of custom MigrationResolvers
sqlMigrationPrefix : File name prefix for Sql migrations
sqlMigrationSeparator : File name separator for Sql migrations
sqlMigrationSuffix : File name suffix for Sql migrations
encoding : Encoding of Sql migrations
placeholderReplacement : Whether placeholders should be replaced
placeholders : Placeholders to replace in Sql migrations
placeholderPrefix : Prefix of every placeholder
placeholderSuffix : Suffix of every placeholder
target : Target version up to which Flyway should use migrations
outOfOrder : Allows migrations to be run “out of order”
callbacks : Comma-separated list of FlywayCallback classes
validateOnMigrate : Validate when running migrate
cleanOnValidationError : Automatically clean on a validation error
baselineVersion : Version to tag schema with when executing baseline
baselineDescription : Description to tag schema with when executing baseline
baselineOnMigrate : Baseline on migrate against uninitialized non-empty schema
configFile : Config file to use (default: conf/flyway.properties)
configFileEncoding : Encoding of the config file (default: UTF-8)
jarDirs : Dirs for Jdbc drivers & Java migrations (default: jars)

Add -X to print debug output
Add -q to suppress all output, except for errors and warnings

Example
=======
flyway -target=1.5 -placeholders.user=my_user info

More info at http://flywaydb.org/documentation/commandline

March 5th, 2016

Posted In: SQL

Tags: , , ,