Blog Post

Friday Flyway Tips: Visualizing Undo Scripts

,

One nice thing with Flyway Enterprise is that it will automatically generate the undo scripts for migration scripts. However, it used to be that finding these and seeing the script was hard. It’s easier after Flyway Desktop 6.5.2

I’ve been working with Flyway Desktop for work more and more as we transition from older SSMS plugins to the standalone tool. This series looks at some tips I’ve gotten along the way.

Undo Scripts

If you have Flyway Enterprise, you can have Flyway Desktop automatically generate scripts: both forward (versioned) and undo scripts.

The config option for this is in project options, which is in the upper right.

2023-08-10 15_53_53-Flyway Desktop

Clicking this

2023-08-10 15_53_57-Flyway Desktop

Once have this, if you add a new object, when you generate the migration script, Flyway Desktop will generate the undo script. In the older UI (pre 6.5) this was a script below the generated script, which meant you had to scroll down, or up and down to compare the forward and undo scripts.

The new UI is better. Now there is just a button. Let me show you how to do this.

First, I have a few changes in the schema model. I’ll select one.

2023-08-21 12_27_19-Flyway Desktop

Now I’ll generate the scripts. When I do that, I see the two scripts. The versioned (forward) script is first, and you can see the “Undo” at the bottom.

2023-08-21 12_28_05-Flyway Desktop

Below this, the rest of the undo script is visible if I scroll down.

2023-08-21 12_28_12-Flyway Desktop

It’s a bit of a pain to scroll up and down, so there is a small improvement in the migrations tab. If I go there, I can find my script at the bottom of the list and click it.

2023-08-21 12_30_33-Flyway Desktop

At the top of the script, in the bar, there is now a set of toggle buttons for version and undo.

2023-08-21 12_24_35-Flyway Desktop

I can click back and forth to easily see both scripts. The V script is above, and the undo is below.

2023-08-21 12_39_44-Flyway Desktop

Try it out today. If you haven’t worked with Flyway Desktop, download it today. There is a free version that organizes migrations and paid versions with many more features.

Video Walkthrough

I made a quick video showing this as well. You can watch it below, or check out all the Flyway videos I’ve added:

 

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating