Redgate Flyway

Tutorial - Run code analysis on deployment script

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

  1. 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.


  2. 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.

Related command reference




Didn't find what you were looking for?