1

Flyway Desktop Projects for My PoC | Voice of the DBA

 1 year ago
source link: https://voiceofthedba.com/2023/01/30/flyway-desktop-projects-for-my-poc/
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.

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 series of working through Flyway and Flyway desktop to demo database changes. Disclosure: I work for Redgate Software.

Flyway Desktop

Flyway Desktop (FWD) is the GUI that Redgate built on top of Flyway for managing your database project. This replaces the SQL Source Control and SQL Change Automation products that we used to try and integrate into IDEs.

I like Flyway Desktop, which is standalone app for capturing code and committing it to Git. It is a project based app, so you set up a project in a folder for a particular database (and possibly schema). In my case, I’m going to set up two projects to start for my PoC.

Version Control

We work with Git, which has become the de facto VCS for most people.

On GitHub, I set up a public project where I’m putting this repository. It is located at: https://github.com/way0utwest/FWPoC

This is on my local machine as a copy at e:\Documents\Git\FWPoC

MSSQL

The first project I’m setting up is my SQL Server project, in a folder called MSSQL under the root of the git repo. This is a project folder just for Flyway Desktop. Once I create the folder, I’m going to create a new project in FWD.

2022-12-28 17_05_51-Flyway Desktop

I get a form after clicking New project. I’ll set the name as MSSQL, choose the root folder, and since I created the folder, I uncheck the checkbox. While I appreciate it’s good to put things in a subfolder, at times I’ve had FWD make a subfolder under the folder I choose, so I’m wary of this box. Mostly because I make mistakes.

2022-12-28 17_05_33-Flyway Desktop

Once this is created, I start in the Schema Model tab. I hate this nomenclature, as it’s weird. This is the list of objects whose code I’m capturing. There’s nothing here, because I need to link this to my development database.

2022-12-28 17_07_44-Flyway Desktop

If I click the “Link” button at the bottom, I get a dialog for the JDBC connection string. Don’t worry, you don’t need to know Java. Just fill in the boxes.

2022-12-28 17_09_47-Flyway Desktop

Two things in the dialog above.

One: Click Trust Server Certificate. Most new installations of SQL and driver upgrades require this. I don’t know why we don’t have this checked by default.

Two: Click “test connection” in the lower left, so if you have issues, this gets found quickly.

Once this is done, I go back to the Schema model and I see this:

2022-12-28 17_11_44-Flyway Desktop

I’ll select this object and save this to the project. This puts the file in the file system for this object, but doesn’t commit this to version control. We can see this in Visual Studio Code below. This is just a git repo, so if I open it in VSCode, I can see the file, the contents, and a note there are changes to be committed in the left icon.

2023-01-03 12_31_22-dbo.Demo.sql - FWPoC - Visual Studio Code

One project complete.

PostgreSQL

My second project is for PostgreSQL. Same git repo, similar process. I’ll create a new project, but say this is a PostgreSQL project.

2023-01-03 12_33_16-Flyway Desktop

The process is the same. I’ll link this to a dev database. I need to specify the port and database I’m using. I also specify the schema here, as it’s not the default.

2022-12-27 17_36_50-Flyway Desktop

Once I get the project connected, I see the same as I did above for SQL Server. I save it, and I get a slightly different structure in the project. I see a schema below the schema-model folder. In here, I see my table, but it’s not the code, but a description.

2023-01-03 12_37_14-demo.rgm - FWPoC - Visual Studio Code

From here, I just commit and push this stuff up to the repo. Note that commits and pushes, can push everything from both projects as they are in one repo. I did this on purpose to keep everything organized for me. However, if this were a team, I’d likely separate SQL Server and PostgreSQL into separate repos so individual developers don’t get confused.

The next step here is to get a second database to where I can deploy changes for each project. I’ve got these set up, and in the next post, we’ll work on an initial deployment.


Recommend

  • 2
    • voiceofthedba.com 1 year ago
    • Cache

    Starting the Flyway PoC–Environment

    I’ve had a goal to redo my demo environments and get them set up to work for a variety of customers in different places. I decided to do this in a way that uses new Redgate technology, with the integration of Flyway with Flyway Desktop. Thi...

  • 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...

  • 1

    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 b...

  • 0

    I saw a post that Flyway Desktop has a dark mode and I had to try it out. I’ve been working with Flyway Desktop for work more and more as we transition from older SSMS plugins to the standalone tool.

  • 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 代码中,不仅支持...

  • 5

    Flyway 助力数据库脚本自动化管理攻略 发表于 2019-10-21 | 数据存储 | MySQL ...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK