Category: Blog

  • Flyway Tips: Immediate Code Review for Developers

    At the Redgate Summits this year, we’ve highlighted a few things in the Flyway solution that help developers improve their ability to get work done safely and quickly. While lots of developers are moving to automated systems and catching issues in pipelines, plenty of you are still working in an IDE.

    This post looks at the new code analysis feature in Flyway Desktop that can help warn you of potential issues before you create that PR.

    I’ve been working with Flyway and Flyway Desktop and helping customers improve their database development. This series looks at some tips I’ve gotten along the way.

    Generating Good Migration Scripts

    Flyway gives you determinism and consistent scripting when you generate migration scripts. Plenty of developers still do this manually, often after a lot of work and testing is done on the schema model. Once you’re sure of the changes you want to make, you can select those changes to include in a deployment.

    As you can see below, I have a lot of changes, but I want to just pick one to put into a deployment.

    2026-07_0253

    If I click on the change, you will see that this is simply adding a new column, something developers do all the time. I’ll select that and click “Generate Migrations”2026-07_0254

    When the tab changes, the default screen shows the next numbered migration script, based on my patterns and a default description of my name. Note that there is also a “Code review checks in progress” item to the left, which is running as the code is generated.

    2026-07_0256

    Once this completes, you can see my code rules passed, and the Flyway AI has generated a better description of the changes than I might have typed in.

    2026-07_0257

    There are a number of rules by default, and these are run when the migration script is generated. You can change, add, disable, customize, etc. for these rules as appropriate for your project.

    Let’s go back and select a different change. In this case, I’m selecting the “Grant” table and dropping it. It’s in the current view of the db, but not the next one.

    2026-07_0255

    When I click Generate Migrations and go to the next tab, you can see that the code review shows me two things: a high severity error and a warning. These are summarized at the top next to the “2 issues” button (which hides or reveals the details) as dots. If I had a lot of issues, and some of you do, this gives me a quick look.

    2026-07_0258

    Below that I get the details. Both of these are for the same line, which is highlighted in the middle by a triangle next to that line.

    If I click the High Severity item, I have the options to learn more, which links to the actual rule on the Redgate documentation site. Or I can ignore it. This allows me to comment in the code to not run this review again.

    2026-07_0259

    For the warning, since this wouldn’t stop a deployment anyway, I just have a Learn more link.

    2026-07_0260

    There are certainly times this might be the desired action, so I like the ignore button. However, much of the time developers might be making changes to objects and not thinking about potential future issues. Code review here catches things early, before others have to get involved, and helps educate developers about the styles and standards we want enforced in our projects.

    If you work with Flyway, update your desktop and give it a try. We would love to hear your feedback.

    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

    Watch me do this in video:

  • Learn about Modern Microsoft Apps in San Diego

    I wrote about learning today for the editorial: I Can’t Make You Learn. I sure hope you want to learn. It’s been great for my career and it will help yours.

    Join me this September in San Diego (register). I used to live there (Carlsbad) and it’s a beautiful, wonderful part of California to visit. VS Live comes to San Diego, and I’m honored to be speaking this year.

    2026-07_0297

    Visual Studio Live! (VSLive!) San Diego 2026 is at the Bahia Resort Hotel, September 14–18, 2026 in San Diego, CA. It’s five days of immersive developer training right on Mission Bay.

    I think actually worked as a waiter for a wedding in this hotel. If not this one, then one of the others right there on Mission Bay. It’s a great place to stay and I’m looking forward to going back.

    Whether you’re building modern apps on the Microsoft stack (.NET, ASP.NET Core, C#, Blazor, .NET MAUI) or focused on cloud and AI (Azure, GitHub Copilot, AI-powered development, Kubernetes, modern data platforms), this is real-world instruction, hands-on labs, and direct access to expert speakers, Microsoft engineers, and MVPs. Learn more: vslive.com/sandiego

    I’ll be discussing local LLM models, which I think are important for the future. You might not want an LLM on your laptop (maybe a MLM or SLM), but your org might want local models in its data center. I’ll also be discussing the Data API builder, which is a great piece of tech that makes your development against a database much easier, whether you write the code or an AI agent helps.

    Save $500 off standard pricing with my exclusive code JONES. Be sure to register by July 17th.

    Register with my code here: https://na.eventscloud.com/ereg/newreg.php?eventid=865669&discountcode=JONES

  • A New Word: Attriage

    attriage – n. the state of having lost all control over how you feel about someone – not even trying to quench the flames anymore, but lighting other fires around your head just hoping to contain the damage.

    My first thought is that this is a crush-type of feeling, of young love and desire. However, I quickly think of my wife and while I am so in love with her, and there is still passion, I’ve definitely lost control of myself in other ways.

    I can’t imagine living without her. I don’t handle it well when we argue. She means so much to me, that there is attriage and I flow with it. Enjoying the struggle and appreciating I have someone like her in my life.

    Then I think about others.

    My wife lost a student and friend this weekend to cancer. I’ve lost friends, and I keep following Hugo’s blog, worried that I’ll never get the chance to hug him and speak in person. I sent a birthday message to Steve Hughes, who is amazing and inspiring, and makes me sad.

    I have attriage about those people, more from worry and loss and yet I have to continue to go on, understand this is part of life, and it sucks.

    Having amazing things in your life means you also have really bad things in your life. You care, and you can’t help but see the differences. If you’re luck, you get into attriage and go with the pain and excitement.

    From the Dictionary of Obscure Sorrows

  • Capturing My Own Metrics: #SQLNewBlogger

    A customer was trying to compare two tables and capture a state as a performance metric. In this case, they were wanting to use Redgate Monitor and custom metrics, but since the tables were in a Memory-Optimized table, they couldn’t as Redgate Monitor runs inside a transaction.

    Note, there are workarounds, but they’re clunky.

    Fortunately, I had a quick solution, which involved SQL Server User Settable Objects. This post looks at how this works.

    The Scenario

    Let’s take the transaction out of the equation by using my own metric. SQL Server includes a few procedures that fall into a pattern. They are named with numerics as shown:

    • sp_user_counter1
    • sp_user_counter2
    • sp_user_counter3
    • sp_user_counter10

    Each of these corresponds to a value that is captured in a perfmon counter. The counters are in the objects called “SQLServer:User Settable”. The counter name is “query” and the instance is “User Counter n” where n is the number corresponding to the stored procedure.

    By default, these are 0, and you can see them here:

    2026-06_0191

    You can also see them in Perfmon

    2026-06_0192

    I’ll stick with SQL Server.

    If I want to alter a value, I call the appropriate procedure. I can do something like call the proc for 5 and set a value. I’ll then query the counters from T-SQL. You can see this below as the value for counter 5 is set to 3.

    2026-06_0193

    This value remains set. I’ll set counters 2 and 8 to 2, and then query again. Note that 5 is still set.

    2026-06_0194

    If I want the value set to 0, I need to set it. I’ll do that for counter 8.

    2026-06_0195

    These are metrics, so I need to pick an integer. I can’t set a decimal (or other type) and have it work. If the implicit conversion works, it works, but the value is a decimal.

    2026-06_0196

    If I make this a string, it fails with an error as ‘2.5’ doesn’t convert to an int. Same for a date. Using an int, like ‘5’, works.

    Solving the Issue

    In this case, for the customer, we solved the issue with a proc that performed their query The result of this query (and int) is sent to a counter value like this:

    CREATE or alter proc My_Checker AS BEGIN declare @i int select @i = count(*) from dbo.Customer a INNER JOIN dbo.Candidates b on a.CustomerName = b.PersonName select @i = @i + 1 EXEC dbo.sp_user_counter1 @1; END

    This can run from an Agent job on their schedule, updating the counter as appropriate.

    For their alerting, they can query this metric and set the boundaries that matter to them. In this case, whenever this is greater than 0, they want an alert.

    The user settable values aren’t that useful, especially as there are 10, but I’ve used them in a few places when I wanted to get instrumentation for an application. This allows me to easily capture values and watch them from any monitoring system.

    Worth knowing about and using if you need random things captured.

    SQL New Blogger

    This post took me around 15 minutes to write, though I spent about 10 minutes mocking this for our customer based on their system and then stripping out a few items that are specific to them.

    This is a post that shows how I can use features of SQL Server to solve a problem, which is something every employer wants. An AI would make this code easier, but I have to know to guide an AI in this direction and evalaute if this works. I’d certainly need to check if other apps were using these counters, which isn’t something an AI might think to do, especially as there could be lots of repos to scan.

    You can write something like this, showing how you’re use this features. Bonus points if you use an AI to help you (and disclose how).