Skip to main content

flyway CLI reference

ModularPipelines.Flyway provides strongly typed access to the flyway CLI.

Executable prerequisite​

This package does not install the flyway executable. Install it separately and ensure flyway is available on PATH.

Follow the executable's official documentation for installation instructions.

Package installation​

dotnet add package ModularPipelines.Flyway

Resolve the service with context.Tools.Flyway. Projects using C# 13 or another .NET language can use context.Tools.Get<ModularPipelines.Flyway.Services.IFlyway>() instead.

Module example​

Resolve the service in a module, then select a command from the table below. A runnable example is omitted when no command has complete safety metadata:

var flyway = context.Tools.Flyway;

Global options​

Global options are rendered before the selected subcommand.

CLI optionPropertyAvailabilityDescription
-baselineDescriptionBaselineDescriptionAll editionsDescription to tag schema with when executing baseline
-baselineOnMigrateBaselineOnMigrateAll editionsBaseline on migrate against uninitialized non-empty schema
-baselineVersionBaselineVersionAll editionsVersion to tag schema with when executing baseline
-batchBatchFlyway Teams[teams] Batch SQL statements when executing them
-callbacksCallbacksAll editionsComma-separated list of FlywayCallback classes, or locations to scan for FlywayCallback classes
-cherryPickCherryPickFlyway Teams[teams] Comma separated list of migrations that Flyway should consider when migrating
-cleanDisabledCleanDisabledAll editionsWhether to disable clean
-cleanOnValidationErrorCleanOnValidationErrorAll editions[Deprecated] Automatically clean on a validation error
-colorColorAll editionsWhether to colorize output. Values: always, never, or auto (default)
-configFileEncodingConfigFileEncodingAll editionsEncoding to use when loading the config files
-configFilesConfigFilesAll editionsComma-separated list of config files to use
-connectRetriesConnectRetriesAll editionsMaximum number of retries when attempting to connect to the database
-createSchemasCreateSchemasAll editionsWhether Flyway should attempt to create the schemas specified in the schemas property
-detectEncodingDetectEncodingFlyway Teams[teams] Whether Flyway should try to automatically detect SQL migration file encoding
-driverDriverAll editionsFully qualified classname of the JDBC driver
-dryRunOutputDryRunOutputFlyway Teams[teams] File where to output the SQL statements of a migration dry run
-encodingEncodingAll editionsEncoding of SQL migrations
-errorOverridesErrorOverridesFlyway Teams[teams] Rules to override specific SQL states and errors codes
-executeInTransactionExecuteInTransactionAll editionsWhether SQL should execute within a transaction
-failOnMissingLocationsFailOnMissingLocationsAll editionsWhether to fail if a location specified in the flyway.locations option doesn't exist
-ignoreMigrationPatternsIgnoreMigrationPatternsAll editionsPatterns of migrations and states to ignore during validate
-initSqlInitSqlAll editionsSQL statements to run to initialize a new database connection
-installedByInstalledByAll editionsUsername that will be recorded in the schema history table
-jarDirsJarDirsAll editionsComma-separated list of dirs for Jdbc drivers & Java migrations
-jdbcProperties.JdbcPropertiesAll editionsProperties to pass to the JDBC driver object
-licenseKeyLicenseKeyFlyway Teams[teams] Your Flyway license key
-locationsLocationsAll editionsClasspath locations to scan recursively for migrations
-lockRetryCountLockRetryCountAll editionsThe maximum number of retries when trying to obtain a lock
-mixedMixedAll editionsAllow mixing transactional and non-transactional statements
-nNonInteractiveAll editionsSuppress prompting for a user and password
-outOfOrderOutOfOrderAll editionsAllows migrations to be run "out of order"
-outputFileOutputFileAll editionsSend output to the specified file alongside the console
-outputTypeOutputTypeAll editionsSerialise the output in the given format, Values: json
-passwordPasswordAll editionsPassword to use to connect to the database
-placeholderPrefixPlaceholderPrefixAll editionsPrefix of every placeholder
-placeholderReplacementPlaceholderReplacementAll editionsWhether placeholders should be replaced
-placeholders.PlaceholdersAll editionsPlaceholders to replace in sql migrations
-placeholderSuffixPlaceholderSuffixAll editionsSuffix of every placeholder
-qQuietAll editionsSuppress all output, except for errors and warnings
-repeatableSqlMigrationPrefixRepeatableSqlMigrationPrefixAll editionsFile name prefix for repeatable SQL migrations
-resolversResolversAll editionsComma-separated list of custom MigrationResolvers
-schemasSchemasAll editionsComma-separated list of the schemas managed by Flyway
-scriptPlaceholderPrefixScriptPlaceholderPrefixAll editionsPrefix of every script placeholder
-scriptPlaceholderSuffixScriptPlaceholderSuffixAll editionsSuffix of every script placeholder
-skipDefaultCallbacksSkipDefaultCallbacksAll editionsSkips default callbacks (sql)
-skipDefaultResolversSkipDefaultResolversAll editionsSkips default resolvers (jdbc, sql and Spring-jdbc)
-skipExecutingMigrationsSkipExecutingMigrationsAll editionsWhether Flyway should skip actually executing the contents of the migrations
-sqlMigrationPrefixSqlMigrationPrefixAll editionsFile name prefix for versioned SQL migrations
-sqlMigrationSeparatorSqlMigrationSeparatorAll editionsFile name separator for SQL migrations
-sqlMigrationSuffixesSqlMigrationSuffixesAll editionsComma-separated list of file name suffixes for SQL migrations
-streamStreamFlyway Teams[teams] Stream SQL migrations when executing them
-tableTableAll editionsName of Flyway's schema history table
-targetTargetAll editionsTarget version up to which Flyway should use migrations
-undoSqlMigrationPrefixUndoSqlMigrationPrefixFlyway Teams[teams] File name prefix for undo SQL migrations
-urlUrlAll editionsJdbc url to use to connect to the database
-userUserAll editionsUser to use to connect to the database
-validateMigrationNamingValidateMigrationNamingAll editionsValidate file names of SQL migrations (including callbacks)
-validateOnMigrateValidateOnMigrateAll editionsValidate when running migrate
-XDebugAll editionsPrint debug output

Commands​

CLI commandOptions record
flyway addFlywayAddOptions
flyway authFlywayAuthOptions
flyway baselineFlywayBaselineOptions
flyway checkFlywayCheckOptions
flyway cleanFlywayCleanOptions
flyway deployFlywayDeployOptions
flyway diffFlywayDiffOptions
flyway diffApplyFlywayDiffApplyOptions
flyway diffTextFlywayDiffTextOptions
flyway generateFlywayGenerateOptions
flyway infoFlywayInfoOptions
flyway initFlywayInitOptions
flyway list-enginesFlywayListEnginesOptions
flyway migrateFlywayMigrateOptions
flyway prepareFlywayPrepareOptions
flyway repairFlywayRepairOptions
flyway snapshotFlywaySnapshotOptions
flyway undoFlywayUndoOptions
flyway validateFlywayValidateOptions
flyway versionFlywayVersionOptions