1

Friday Flyway Tips: Visualizing Undo Scripts | Voice of the DBA

 9 months ago
source link: https://voiceofthedba.com/2023/09/01/friday-flyway-tips-visualizing-undo-scripts/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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.

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.

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:


Recommend

  • 21

    本文大纲 flyway是什么 能帮助我们解决什么问题 springboot环境下使用flyway flyway的工...

  • 19

    分享一个最近在整Flyway时候碰到的一个问题,以及对应的一些解决方案。如果您还不知道Flyway,建议可以先看一下这篇文章 Spring Boot中使用Flyway来管理数据库版本

  • 37

    在项目迭代开发中,难免会有更新数据库 Schema 的情况,比如添加新表、在表中增加字段或者删除字段等,那么当我对数据库进行一系列操作后,如何快速地在其他同事的电脑上同步?如何在测试/生产服务器上快速同步?

  • 11
    • vladmihalcea.com 4 years ago
    • Cache

    Flyway Database Schema Migrations

    Introduction In this article, I’m going to explain how Flyway works and how you can use it to run automated database schema migrations using incremental SQL migration script...

  • 7

    Flyway 是一款开源的数据库版本管理工具,它更倾向于规约优于配置的方式。Flyway 可以独立于应用实现管理并跟踪数据库变更,支持数据库版本自动升级,并且有一套默认的规约,不需要复杂的配置,Migrations 可以写成 SQL 脚本,也可以写在 Java 代码中,不仅支持...

  • 0
    • voiceofthedba.com 2 years ago
    • Cache

    Flyway Mistakes | Voice of the DBA

    Flyway Mistakes I have been doing some testing with Redgate’s Flyway Desktop as a new way of managing code for databases. However, just like...

  • 3
    • voiceofthedba.com 2 years ago
    • Cache

    Visualizing SQL | Voice of the DBA

    Visualizing SQL While I think SQL is interesting, I know some people struggle with the way the language work. Someone at work posted a l...

  • 1

    In a previous post, I set up the basic databases for the PoC project I’m working on. In this next post, we’ll get the Flyway Desktop projects set up for the PoC. This is part of a

  • 3

    Next Up 15 Google Chrome Settings You Need To Change Immediately

  • 0
    • voiceofthedba.com 6 months ago
    • Cache

    Friday Flyway Tips–Comparison Options

    Recently a customer asked how they could get index changes to be captured in Flyway Desktop. In their case, they wanted a different fill factor, but I decided to investigate a bit more how things work. This post looks at how to control the...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK