Common state-based deployment scripts

Deployment with manual review step when the target environment is configured in toml

# Generate a deployment report, containing list of objects changes (optional)
flyway check -changes -changesSource=schemaModel -environment=production
  
# Generate a deployment script, which can be reviewed
flyway prepare -source=schemaModel -target=production -scriptFilename="D__deployment.sql"

### Manual review step ###
  
# Execute deployment script against the target environment
flyway deploy -scriptFilename="D__deployment.sql" -environment=production

This script generates a deployment report, and allows for a manual review before deployment. It uses the check changes, prepare, and deploy commands.

Deployment with manual review step when the target environment is configured inline

# Generate a deployment report, containing list of objects changes (optional)
flyway check -changes -changesSource=schemaModel "-url=<JDBC URL>"
  
# Generate a deployment script, which can be reviewed
flyway prepare -source=schemaModel "-url=<JDBC URL>" -scriptFilename="D__deployment.sql"


### Manual review step ###

# Execute deployment script against the target environment
flyway deploy -scriptFilename="D__deployment.sql" "-url=<JDBC URL>"

This script generates a deployment report, and allows for a manual review before deployment. It uses the check changes, prepare, and deploy commands.

Full automated deployment

# Generate a deployment report, containing list of objects changes (optional)
flyway check -changes -changesSource=schemaModel -environment=production

# Combined script generation and deployment, with script generated to default location
flyway prepare deploy -prepare.source=schemaModel -environment=production

This script generates a deployment report, and skips the manual review step. It uses the check changes, prepare, and deploy commands. Note: be careful of the namespaced parameters.

Undo script generation

# Generate a deployment script and a corresponding undo script
flyway prepare -source=schemaModel -target=production -types=deploy,undo -scriptFilename="D__deployment.sql" -undoFilename="DU__undo.sql"

This script generate a deployment script which can be used to rollback the deployment. It uses the prepare command.


Didn't find what you were looking for?