Redgate Flyway

Tutorial - Drift Report for deployments using embedded snapshot

FLYWAY ENTERPRISE

  1. Save a snapshot on deployment using one of the following options
    1. If using state-based or migrations-based deployments
      flyway deploy -environment=production -saveSnapshot=true
    2. If using migrations-based deployment
      flyway migrate -baselineOnMigrate=true -environment=production -saveSnapshot=true
    3. Or, take a snapshot ad-hoc
      flyway snapshot -source=production -filename="snapshotHistory:ad-hoc deployment"

      In the examples above, "production" is the ID of a database environment that is defined in the project and provides the connection information for the database that you want to capture in a snapshot.

      If this is the first time you're saving a snapshot in the target database, then the snapshot history table will be created.


  2. Use the saved snapshot in the target database to check for drift


    flyway check -drift -environment=production -failOnDrift=true


    1. Navigate to the Migration scripts page
    2. Connect to your target environment, by selecting the relevant connection from the Target database dropdown, or adding a new target configuration.
    3. Select Check from the command dropdown in the right hand pane
    4. Check the drift flag under the command dropdown
    5. Expand the Advanced settings and click Add parameters
    6. Select check.failOnDrift from the drop down.  You can start typing to limit the results and find the parameter you need easier.
    7. Enter true for the parameter value.
    8. Click Add parameter.
    9. Click Back.
    10. Click Run check
  3. Review the report
    In this example, 1 object has changed since the snapshot was taken.  Drilling down, you can see the exact changes.  A new "DriftedColumn" was added to the Customers table. 

Learn more



Didn't find what you were looking for?