Redgate Flyway

Database Development using Flyway

Overview

Flyway Desktop helps you easily and safely version control your database schema and prepare deployments for SQL Server, PostgreSQL and Oracle databases. 

Flyway Desktop captures snapshots of your database objects into a schema model. You can version control and share changes to the schema model with teammates to rapidly iterate on new development. When you are ready to prepare a deployment, you generate migration scripts to deploy these changes safely.  Migration scripts are also committed to version control and are used as part of an automated CI/CD process to validate and deploy database changes to other environments (e.g., Test, Staging, Prod).


Watch this 6.5 minute video for a quick overview.

Get started with Flyway Desktop

  1. Download and install the latest version of Flyway Desktop for Windows or Flyway Desktop for MacOS. See system requirements for more information on supported Operating Systems.
  2. Launch Flyway Desktop from the start menu.
  3. You can create a new project, open an existing project that your team member setup, or import an existing Flyway configuration.
  4. Once you have opened/created a project, go to the Schema model tab
    1. You will be prompted to configure a development database.
    2. Refresh to see changes that have been made to your development database that aren't in your project schema model yet. You can select the changes that you want to import.
      1. Alternatively, press the Apply to database toggle to invert the comparison. This allows you to update your database to match the project schema model.
    3. When you have made your selections, click Save to capture them.
  5. At this point there are several options:
    1. Go to the Version control tab or open your project in an external version control client to commit your changes to version control.
    2. Continue to iterate on making changes to your development database and updating the schema model.
    3. When you are ready to deploy your changes, go to the Generate migrations tab to selectively capture your schema model changes in a migration script
      1. When you first use the Generate migrations tab, Flyway Desktop prompts you to generate a baseline migration script. This is required in all situations where you are intending to deploy to a non-empty database. As a one-off operation the application will need to link to a downstream database which you are intending to make changes to via this pipeline, in order to generate a script which captures the existing state of the database.  Learn more about creating a baseline script.
  6. Once you have generated a migration script, go to the Version control tab or open your project in an external version control client to commit it to version control. 
  7. Migration scripts can be deployed on the Migrations tab or by running the flyway migrate command. You can either run this command manually or as part of a CI/CD pipeline.
    1. Within a single migration run, all the pending versioned migrations that have never been applied to the database are run in alphabetical order.
    2. To keep track of which migrations have already been applied when and by who, the flyway_schema_history table is added to the first schema that you're tracking changes to.
    3. If you want your migration scripts to be in version control and part of an automated validation and deployment process, learn more about how to deploy database changes as part of your CI/CD process.


You can run Flyway commands against configurations created and used by Flyway Desktop.  This allows you to use advanced Flyway features that are not implemented within Flyway Desktop yet (for example, callbacks). Make sure you either run Flyway in the same directory that contains your flyway.conf file or set the workingDirectory command line option. This will ensure that Flyway reads the correct configuration file and resolves the path to the migrations folder appropriately. 

Feedback

We’re looking to continually improve Flyway Desktop.  Please share questions and feedback with us via this quick survey.

Additional 'Getting Started' topics

Helpful links when getting started




Didn't find what you were looking for?