Share your experience with Database DevOps by taking part in the 2021 State of Database DevOps survey Take the survey

Command-line: info

Prints the details and status information about all the migrations.

info

Usage

> flyway [options] info

Options

Option Required Default Description
url YES The jdbc url to use to connect to the database
driver NO Auto-detected based on url The fully qualified classname of the jdbc driver to use to connect to the database
user NO The user to use to connect to the database
password NO The password to use to connect to the database
connectRetries NO 0 The maximum number of retries when attempting to connect to the database. After each failed attempt, Flyway will wait 1 second before attempting to connect again, up to the maximum number of times specified by connectRetries.
initSql NO none The SQL statements to run to initialize a new database connection immediately after opening it.
defaultSchema NO The default schema for the database connection The default schema managed by Flyway. This schema name is case-sensitive.

Consequences:

  • This schema will be automatically set as the default one during the migration.
  • This schema will also be the one containing the schema history table.
  • If this schema is not specified then it will default to the first member of schemas.
schemas NO The default schema for the database connection Comma-separated list of schemas managed by Flyway. These schema names are case-sensitive.

Consequences:

  • Flyway will automatically attempt to create all these schemas, unless the first one already exists.
  • The schemas will be cleaned in the order of this list.
  • If Flyway created them, the schemas themselves will as be dropped when cleaning.
  • defaultSchema will default to the first member of this list if not explicitly specified.
Read more about Flyway support for multiple schemas in our FAQs
table NO flyway_schema_history The name of Flyway's schema history table.
By default (single-schema mode) the schema history table is placed in the default schema for the connection provided by the datasource.
When the flyway.schemas property is set (multi-schema mode), the schema history table is placed in the first schema of the list.
locations NO filesystem:<install-dir>/sql Comma-separated list of locations to scan recursively for migrations. The location type is determined by its prefix.
Unprefixed locations or locations starting with classpath: point to a package on the classpath and may contain both SQL and Java-based migrations.
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.
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)
color NO n/a (Command line flag only) Whether to colorize output. If set to 'auto', will print color if a console is detected. Defaults to 'auto'. (always, never, or auto)
jarDirs NO <install-dir>/jars Comma-separated list of directories containing JDBC drivers and Java-based migrations
sqlMigrationPrefix NO V

The file name prefix for versioned SQL migrations.

Versioned SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1.1__My_description.sql
undoSqlMigrationPrefix Flyway Teams NO U

The file name prefix for undo SQL migrations.

Undo SQL migrations are responsible for undoing the effects of the versioned migration with the same version.

They have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to U1.1__My_description.sql
repeatableSqlMigrationPrefix NO R

The file name prefix for repeatable SQL migrations.

Repeatable SQL migrations have the following file name structure: prefixSeparatorDESCRIPTIONsuffix , which using the defaults translates to R__My_description.sql
sqlMigrationSeparator NO __ The file name separator for Sql migrations
sqlMigrationSuffixes NO .sql

Comma-separated list of file name suffixes for SQL migrations.

SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1_1__My_description.sql

Multiple suffixes (like .sql,.pkg,.pkb) can be specified for easier compatibility with other tools such as editors with specific file associations.
validateMigrationNaming NO false Whether to ignore migration files whose names do not match the naming conventions.

If false, files with invalid names are ignored and Flyway continues normally. If true, Flyway fails fast and lists the offending files.
encoding NO UTF-8 The encoding of Sql migrations
placeholderReplacement NO true Whether placeholders should be replaced
placeholders.name NO Placeholders to replace in Sql migrations
placeholderPrefix NO ${ The prefix of every placeholder
placeholderSuffix NO } The suffix of every placeholder
resolvers NO Comma-separated list of fully qualified class names of custom MigrationResolver implementations to be used in addition to the built-in ones for resolving Migrations to apply.
skipDefaultResolvers NO false Whether default built-in resolvers (sql, jdbc and spring-jdbc) should be skipped. If true, only custom resolvers are used.
callbacks NO Comma-separated list of fully qualified class names of Callback implementations to use to hook into the Flyway lifecycle.
skipDefaultCallbacks NO false Whether default built-in callbacks (sql) should be skipped. If true, only custom callbacks are used.
target NO latest The target version up to which Flyway should consider migrations. Migrations with a higher version number will be ignored.
Special values:
  • current: designates the current version of the schema
  • latest: the latest version of the schema, as defined by the migration with the highest version
outOfOrder NO false Allows migrations to be run "out of order".

If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored.

workingDirectory NO default for client The working directory to consider when dealing with relative paths for both config files and locations.
licenseKey NO none Your Flyway license key (FL01...). Not yet a Flyway Pro or Enterprise Edition customer? Request your Flyway trial license key to try out Flyway Pro and Enterprise Edition features free for 30 days.

Sample configuration

flyway.driver=org.hsqldb.jdbcDriver
flyway.url=jdbc:hsqldb:file:/db/flyway_sample
flyway.user=SA
flyway.password=mySecretPwd
flyway.connectRetries=10
flyway.initSql=SET ROLE 'myuser'
flyway.schemas=schema1,schema2,schema3
flyway.table=schema_history
flyway.locations=classpath:com.mycomp.migration,database/migrations,filesystem:/sql-migrations
flyway.sqlMigrationPrefix=Migration-
flyway.undoSqlMigrationPrefix=downgrade
flyway.repeatableSqlMigrationPrefix=RRR
flyway.sqlMigrationSeparator=__
flyway.sqlMigrationSuffixes=.sql,.pkg,.pkb
flyway.encoding=ISO-8859-1
flyway.placeholderReplacement=true
flyway.placeholders.aplaceholder=value
flyway.placeholders.otherplaceholder=value123
flyway.placeholderPrefix=#[
flyway.placeholderSuffix=]
flyway.resolvers=com.mycomp.project.CustomResolver,com.mycomp.project.AnotherResolver
flyway.skipDefaultResolvers=false
flyway.callbacks=com.mycomp.project.CustomCallback,com.mycomp.project.AnotherCallback
flyway.skipDefaultCallbacks=false
flyway.target=5.1
flyway.outOfOrder=false
flyway.workingDirectory=C:/myProject

Sample output

> flyway info

Flyway 7.3.0 by Redgate

Database: jdbc:h2:file:flyway.db (H2 1.3)

+------------+---------+----------------+------+---------------------+---------+----------+
| Category   | Version | Description    | Type | Installed on        | State   | Undoable |
+------------+---------+----------------+------+---------------------+---------+----------+
| Versioned  | 1       | First          | SQL  |                     | Pending | Yes      |
| Versioned  | 1.1     | View           | SQL  |                     | Pending | Yes      |
| Versioned  | 1.2     | Populate table | SQL  |                     | Pending | No       |
+------------+---------+----------------+------+---------------------+---------+----------+

Command-line: validate