Redgate Flyway

Deploy

Flyway Enterprise

The deploy command executes a deployment script against a target database and optionally takes and stores a snapshot of the resulting database schema. Can be used in conjunction with scripts generated by flyway prepare.

Can optionally take a snapshot of the target database on deployment success and store it in the target database or elsewhere. This allows for drift detection on the target database, as well as providing one possible rollback mechanism.

Usage examples

Deploying an arbitrary SQL script and embedding a snapshot

flyway deploy -scriptFilename="D__deployment.sql" -environment=production -saveSnapshot=true

Deploying a deployment script generated by prepare

flyway prepare -source=schemaModel -target=production -scriptFilename=D__deployment.sql -saveSnapshot=true
flyway deploy -scriptFilename="D__deployment.sql" -environment=production

Note that it is also possible to chain these commands:

flyway prepare -source=schemaModel deploy -environment=production -saveSnapshot=true

Deploying to an environment not contained in the TOML configuration

flyway deploy -url="<url>" -user="<user>" -password="<password>" -saveSnapshot=true

Parameters

Optional

Parameter Namespace Description
scriptFilename deploy The path to the script that will be deployed.
saveSnapshot deploy Whether to generate a snapshot of the schema state after deployment.
batch (root) Whether to batch SQL statements when executing them.
configFiles (root) The location of the flyway configuration files.
encoding (root) The encoding of the script to be deployed.
environment (root) The name of the environment to deploy to.
{environment parameters} (root) Environment configuration for the target environment.
executeInTransaction (root) Whether to run the script within a transaction.
workingDirectory (root) The directory to consider the current working directory. All relative paths will be considered relative to this.

Universal commandline parameters are listed here.

JSON output format

{
  "scriptExecuted": "C:\\workingDirectory\\D__deployment.sql",
  "deploymentResults": [],
  "database": "production"
}

Error codes

This command can produce the following error codes:


Didn't find what you were looking for?