Deploy
Published 15 January 2025
The deploy command executes a deployment script against a target database.
Can be used in conjunction with scripts generated by flyway prepare.
Usage examples
Deploying an arbitrary SQL script
flyway deploy -scriptFilename="D__deployment.sql" -environment=production
Deploying a deployment script generated by prepare
flyway prepare -source=schemaModel -target=production -scriptFilename=D__deployment.sql
flyway deploy -scriptFilename="D__deployment.sql" -environment=production
Deploying to an environment not contained in the TOML configuration
flyway deploy \
    -environment=production \
    -environments.production.url="<url>" \
    -environments.production.user="<user>" \
    -environments.production.password="<password>"
Note that it is also possible to chain these commands:
flyway prepare -source=schemaModel deploy -environment=production
Parameters
Optional
| Parameter | Namespace | Description | 
|---|---|---|
| scriptFilename | deploy | The path to the script that will be deployed. | 
| 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: