Flyway

Backup Provisioner and Snapshot Provisioner

Flyway Desktop currently supports the backup and snapshot provisioners behind a feature flag FLYWAY_DESKTOP_CONNECTION_DIALOG_PROVISIONERS (i.e. define this environment variable). The provisioners can be selected by using the cards in the database connection dialog. 

Backup Provisioner

EDITION: ENTERPRISE

This provisioner allows for the provisioning and re-provisioning of databases using a database backup file.

Note: Currently only SQL Server .bak files are supported.

Benefits of using the Backup Provisioner

  • Supports static data and a flyway_schema_history table - allows an environment to be provisioned with data to a desired version.
  • Not impacted by references to invalid objects - a good alternative to a baseline script.
  • Speeds up provisioning shadow environment - restoring a backup file that represents version 1000 is a considerably quicker alternative to executing 1000 migrations scripts.

Prerequisites

  • A database backup .bak file, which could be a backup of a production database for example. This backup file needs to be in a location accessible to the database server that will be provisioned i.e. on the database server itself or on a network share.

 How to configure the Backup Provisioner:

  1. Open the database connection dialog to configure the development/shadow database

      2. The following properties have to be configured:

    • Backup file - The file path of the backup file. Note: this needs to be accessible/relative to the database server that is being provisioned.
    • Backup version - (Optional) - The migration version the backup file represents and is only required when the backup file doesn't contain a flyway_schema_history table.
      • In the scenario that the flyway_schema_history table does not already exist, it will be created once the backup has been restored and a baseline entry with the version entered here will be inserted into the flyway_schema_history table.
      • If the backup file does contain a flyway_schema_history table then this property is optional. If left unset then the flyway_schema_history table from the backup will be restored unaltered.

After populating these fields, you then need to set your database connection as normal.

Please note that when testing connection or subsequently whenever the database needs reprovisioning there may be a slight delay while the provisioning takes place.

For an extended example of how to set this up see here.

Snapshot Provisioner

EDITION: ENTERPRISE

This provisioner allows for the provisioning and re-provisioning of databases using a snapshot file. A snapshot captures the schema of the database current state into a file (Note: This does not contain any static data) which can be generated using the the snapshot command available in Flyway CLI.

Benefits of using the Snapshot Provisioner

  • Speeds up provisioning shadow environment - applying a snapshot that represents version 1000 is a considerably quicker alternative to executing 1000 migrations scripts.

Prerequisites

  • A snapshot file generated using the snapshot command available in Flyway CLI
  • Set the environment variable REDGATE_FLYWAY_DIFF_VERB=true.

 How to configure the Snapshot Provisioner:

  1. Open the database connection dialog to configure the development/shadow database

      2. The following properties have to be configured:

    • Snapshot file - The file path of the snapshot file.
    • Snapshot version - The migration version the snapshot represents. This version will be inserted as the baseline version into the flyway_schema_history table of the provisioned database.
    • Always clean on reprovision - (Optional) When set to true this option forces a clean of the provisioned database before the snapshot is applied. This option may be required when it's not possible to apply the snapshot to the database. For example, if applying the snapshot needs to re-add a non-null column to a table that has data in it.

After populating these fields, you then need to set your database connection as normal.

Please note that when testing connection or subsequently whenever the database needs reprovisioning there may be a slight delay while the provisioning takes place.

For an extended example of how to set this up see here.



Didn't find what you were looking for?