Want more control over your database deployments? – Find out how with Carlos Robles at Redgate Summit Register now

Flyway Documentation

Command-line: baseline

Baselines an existing database, excluding all migrations up to and including baselineVersion.



> flyway [options] baseline


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.


  • 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.


  • 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
createSchemas NO true Whether Flyway should attempt to create the schemas specified in the schemas property. See this page for more details
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)
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.
tablespace NO default for connection The tablespace where to create the schema history table that will be used by Flyway. This setting is only relevant for databases that do support the notion of tablespaces. It's value is simply ignored for all others.
jarDirs NO <install-dir>/jars Comma-separated list of directories containing JDBC drivers and Java-based migrations
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.
baselineVersion NO 1 The version to tag an existing schema with when executing baseline
baselineDescription NO << Flyway Baseline >> The description to tag an existing schema with when executing baseline
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.
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.initSql=SET ROLE 'myuser'
flyway.baselineDescription=Base Migration

Sample output

> flyway baseline

Flyway 7.5.4 by Redgate

Creating schema history table: "PUBLIC"."flyway_schema_history"
Schema baselined with version: 1

Command-line: repair