Database Development using Flyway
Published 11 October 2021
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
- 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.
- Launch Flyway Desktop from the start menu.
- You can create a new project, open an existing project that your team member setup, or import an existing Flyway configuration.
- Once you have opened/created a project, go to the Schema model tab
- You will be prompted to configure a development database.
- 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.
- Alternatively, press the Apply to database toggle to invert the comparison. This allows you to update your database to match the project schema model.
- When you have made your selections, click Save to capture them.
- At this point there are several options:
- Go to the Version control tab or open your project in an external version control client to commit your changes to version control.
- Continue to iterate on making changes to your development database and updating the schema model.
- 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
- 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.
- 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.
- 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.
- Within a single migration run, all the pending versioned migrations that have never been applied to the database are run in alphabetical order.
- 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.
- 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
- About Flyway Desktop
- Database development using Flyway Desktop
- Database DevOps Practices
- Terminology Reference
- Dark mode
- Check for Updates
- Transitioning from other Redgate tools