Common migrations-based deployment scripts
Published 17 September 2025
Full automated deployment when the build and target environments are configured in toml
# Run code analysis on migrations (optional) flyway check -code "-code.failOnError=true" # Check to see if the target environment has drifted since last deployment (optional) flyway check -drift -environment="production" -failOnDrift=true # Generate a deployment report, containing list of objects changes (optional) flyway check -changes -buildEnvironment="build" -environment="production" # Generate a dry run report to preview what would be executed without modifying the database (optional) flyway check -dryrun -environment="production" # Execute pending migrations against the target environment, baselining if this is the first deployment, and embedding a snapshot to enable drift checks flyway migrate -baselineOnMigrate=true -environment="production" -saveSnapshot=true
This script runs code analysis, runs drift analysis, and generates a deployment report, ahead of deployment. It uses the check code, check drift, check changes, check dryRun, and migrate commands.
Full automated deployment when the build and target environments are configured inline
# Run code analysis on migrations (optional) flyway check -code "-code.failOnError=true" # Check to see if the target environment has drifted since last deployment (optional) flyway check -drift -url=<JDBC URL>" -failOnDrift=true # Generate a deployment report, containing list of objects changes (optional) flyway check -changes -buildEnvironment=build "-environments.build.url=<JDBC URL>" "-url=<JDBC URL>" # Generate a dry run report to preview what would be executed without modifying the database (optional) flyway check -dryrun -environment="production" "-url=<JDBC URL>" # Execute pending migrations against the target environment, baselining if this is the first deployment, and embedding a snapshot to enable drift checks flyway migrate -baselineOnMigrate=true "-url=<JDBC URL>" -saveSnapshot=true
This script runs code analysis, runs drift analysis, and generates a deployment report, ahead of deployment. It uses the check code, check drift, check changes, check dryRun, and migrate commands.