Tutorial - Run code analysis on deployment script
Published 16 September 2025
Pre-requisites
- Ensure that Flyway is installed and available on your path
- Ensure that Flyway is authenticated to use enterprise features
- Ensure that any secrets necessary for database connection auth are available
Commands to run
- Use flyway prepare to generate your deployment script:
flyway prepare -source=schemaModel -target=Prod
This defaults to adding a D__deployment.sql file into a deployments folder in your current directory. - Run flyway check -code to run static code analysis checks against the generated deployment script:
flyway check -code -scope=script -scriptFilename="deployments/D__deployment.sql" -failOnError=true
The failOnError setting is optional, and causes the command to return an error if any code violations are detected.
This is not currently possible in Flyway Desktop.