Category: Blog

  • Flyway Tips: Automation Assistance in Flyway Desktop

    I was chatting with the product managers at Flyway and one asked me whether I’d seen the new tab for Automation in Flyway Desktop. I hadn’t and decided to take a quick look at how this works and what’s useful. This post looks at the new feature.

    Tl;Dr this is a good way to start learning how to move to a more DevOps, automated way of deploying changes.

    I’ve been working with Flyway and 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.

    Working with Flyway Desktop

    For a lot of customers, it’s not too hard to setup a project and start to capture code in a Git repo. However, adding in automation gets challenging for many, especially as the docs are hard to understand if you don’t already have some knowledge. I find that CI/CD is a bit of a chicken and egg challenge as we try to learn to get better, but knowing what to learn and do requires knowledge.

    Which we don’t have.

    In any case, I’ve taken an existing Flyway project where I am capturing some code. You can see the project below, with objects on the right. The database and the repo have the same object code and are in sync.

    2025-11_line0127

    Let’s add a few new objects to this database in SSMS. You can see below I’m adding a new table and altering a proc. I’m also refactoring slightly to not keep the old style join convention in my proc as I add a new join.

    2025-11_line0129

    Once I do this, in Flyway Desktop (FWD), I see my changes. I’ll save these to the repo and then generate a migration script. I won’t show that as it’s not important.

    2025-11_line0130

    Once I’ve done this, I know I want to deploy code. If I go to Migrations, I can see I have these two scripts ready to go to QA, and I can deploy them with FWD manually. However, I don’t want to do that.

    2025-11_line0131

    I want some automation. How does FWD make that easy? Let’s see.

    The Automation Tab

    There’s a new tab on the left, which is the Automation tab.  I’ve expanded the left menu out and you can see it, but it’s a lightning bolt, which I might never have noticed (hence this post).

    2025-11_line0132

    If I click this, I get a little explanation at the top, a few links, and then some CLI based code. This last part is the important part of what I need to move to CI/CD.

    2025-11_line0133

    If you look at the code closely, you’ll see some placeholders in angle brackets for the environments I need. The code looks like this:

    2025-11_line0134

    Above this, there are two drop downs where I can select my build and target environments. Build is the CI portion, and it’s a good idea to have a place to build code separate from QA. This lets me validate things, and more importantly, run some code analysis checks, summarize changes, and detect drift.

    I’ve expanded the Build drop down below and you can see I have my environments listed, and I can also manage them from here. There is also an Environments tab on the left menu just above Automate Deployments that looks like a database icon.

    2025-11_line0135

    Once I select an environment, the code changes to reflect this. That makes things easier to automate as I can take these commands and drop them into a task in my CI/CD tool.Note in the image below that I’ve selected NWInt and the code shows target2. The code needs the ID (or PK) of the environment, but the display name I entered is shown in the drop down. Trust me, these match.

    2025-11_line0136

    I’ll also select a target and then open up a CLI to run the first item on line 5. I did have to auth, but this runs successfully. No doc checks, no experimenting, the command ran.

    2025-12_0116

    I’ve never saved any snapshots and so the drift doesn’t work right away, but I’ll get the dryrun script. When I run this, I get a summary from the CLI.

    2025-12_0120

    Then I can see the report (see above output for the path at the end. When this opens, on the Dry Run tab, I see my scripts.

    2025-12_0121

    Note, I did use the drop downs in FWD to select the environments I need for this.

    Very cool.

    Summary

    One of the challenges with using Flyway is that there are a lot of settings, options, and more that one must learn to take advantage of the solution. Our docs continue to improve, but even for someone that has been using Flyway for a few years, I have to constantly check out things work. Plus, the teams are adding features on a regular basis, so it can get confusing to learn the new things.

    This automation tab is really helpful to shortcut some of the things I need for the various environments in my project. I’m going to start using some of this in a new project, and so should you.

    Flyway can do much more, and for smoother automation, check out Flyway Enterprise.

    Flyway is an incredible way of deploying changes from one database to another, and now includes both migration-based and state-based deployments. You get the flexibility you need to control database changes in your environment. If you’ve never used it, give it a try today. It works for SQL Server, Oracle, PostgreSQL and nearly 50 other platforms.

    Video Walkthrough

     

  • The Book of Redgate: What Our Staff Says

    This image is from 2010, and it goes along with my last post of what our Customers Say about us. However, this is what our employees said about the company.

    2025-10_line0105

    At this point we would have been around a 200 person company, mostly in the UK. It’s a great list of words, and if I were looking for a new employer, this type of work cloud might get me interested in applying.

    Redgate has often felt like an extended family, where we care about each other, we’re bonded, and we’re working together to get through life. We disagree and bicker at times, but we love each other.

    We’re now closer to a 600 person company, and I don’t know that all of us, or even most of us, feel the same ways, but I’d like to think most people still think this is a great place to work.

    I do.

    I have a copy of the Book of Redgate from 2010. This was a book we produced internally about the company after 10 years in existence. At that time, I’d been there for about 3 years, and it was interesting to learn a some things about the company. This series of posts looks back at the Book of Redgate 15 years later.

  • PASS Keynote Shots

    Rodney Kidd took some great shots of the keynote and published an album here: https://www.flickr.com/photos/127113040@N04/albums/72177720330695911

    A few of my favorites:

    Here’s one of the 8 ball and keynote (and I’m enjoying myself)

    RG Keynote 20251119 069_fr//embedr.flickr.com/assets/client-code.js

    This is a great shot of the audience

    RG Keynote 20251119 077_fr//embedr.flickr.com/assets/client-code.js

    Am I confused?

    RG Keynote 20251119 127_fr//embedr.flickr.com/assets/client-code.js

    A nice shot of the crew at the end, Grant obviously having fun.

    RG Keynote 20251119 295_fr//embedr.flickr.com/assets/client-code.js

    And a nice shot of my chatting with Tim at the end.

    RG Keynote 20251119 302_fr//embedr.flickr.com/assets/client-code.js

  • Database Collation Matters for Unicode: #SQLNewBlogger

    While trying to work with Unicode data, I found some issues with collation. This post showcases what I’ve seen, with probably not enough answers. The collation/UTF stuff is still slightly confusing to me.

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    Noticing Problems

    I was doing some testing with Unicode data and noticed this sentence in the docs for UNISTR() (image below): “The database collation must be a UTF-8 collation if the input is of char or varchar data types.

    2025-12_0088

    I started experimenting with SQL 2022 with a default, US database. I ran this code:

    SELECT N'Denver ' + NCHAR(0x1F601), DATABASEPROPERTYEX('sandbox', 'Collation')

    That gave me unexpected results. The inputs aren’t char or varchar. They are NCHAR.

    2025-12_0089

    Strange. I’d have expected this to work. Let’s try the COLLATE clause. That should help.

    It doesn’t.

    2025-12_0091

    One Solution

    I decided to create a new database to test things. First, I ran this code to create a database using a UTF-8 collation:

    CREATE DATABASE UnicodeTest COLLATE Latin1_General_100_CI_AS_SC_UTF8

    Next, I tried my test. Same code as above, different database.

    2025-12_0093

    This works. I see my Unicode characters.

    Why, I’m not sure. I would think that my requesting a collation for a query would work, but I see this in the docs, which notes this is for ORDER BY.

    2025-12_0094

    In the Write International T-SQL Statements doc, there is this:

    2025-12_0095

    I’m not sure what UCS-2 means when I’m querying in memory only, but apparently this matters.

    An Explanation

    The real answer is found in the NCHAR() docs. In here, the arguments section notes this:

    2025-12_0096

    The key is the Unicode value. NCHAR() handles up to 0xFFFF (4 Fs). My value is 0x1F40E (5 characters), so it’s out of range for the values that are handled with a non SC collation.

    If I return to my Sandbox, non SC collation database, I can get Unicode characters, as long as they are below the FFFF threshhold.

    2025-12_0097

    A fun little experiment, where I learned something.

    SQL New Blogger

    This is a great example of my finding a problem, digging in, and solving it. Around some other work, this probably took me about 30 minutes to figure out with some reading and experimenting. Then about 15 minutes to write this post.

    This is something you could easily do and showcase your knowledge as someone looking to learn and grow.