Tag: FWTips

  • Friday Flyway Tips–Capture the Filegroup for Tables

    A customer asked recently why Flyway doesn’t detect the filegroup for some changes. I showed them it does and decided to write a post on this.

    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.

    Setting Up Filegroups

    I don’t see a lot of SQL Server databases using filegroups. They can be helpful, and they can create complexity, but they aren’t good or bad. Some people use them, and for various reasons. If you use them, you’ve probably run some code like this:

    ALTER DATABASE [EngineRoomDemo_1_Dev] ADD FILEGROUP [indexes]
    GO
    ALTER DATABASE [EngineRoomDemo_1_Dev] ADD FILE ( NAME = N'index1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\shadow_index1.ndf' , SIZE = 8192KB , FILEGROWTH = 65536KB ) TO FILEGROUP [indexes]
    GO

    Here I’ve added a new filegroup, called indexes, and a file in this group. This isn’t set as the default.

    Since I’m working with Flyway Enterprise and generating scripts, I do need to also alter my shadow database, so that I can both detect changes and also verify my scripts. I’ll use this code:

    ALTER DATABASE [EngineRoomDemo_1_Dev_Shadow] ADD FILEGROUP [indexes]
    GO
    ALTER DATABASE [EngineRoomDemo_1_Dev_Shadow] ADD FILE ( NAME = N'index1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\shadow_index1.ndf' , SIZE = 8192KB , FILEGROWTH = 65536KB ) TO FILEGROUP [indexes]
    GO

    Now we can detect changes.

    Detecting Table Changes

    First, let’s actually create a new table on this filegroup. To do that, I create a table, but I add an ON clause, as shown here. After the table creation, I use ON with the name of the filegroup. This ensures this table exists on the file(s) for this filegroup.

    CREATE TABLE [dbo].[newtable](
         [myid] [int] NULL,
         [mychar] [varchar](20) NULL
    ) ON [indexes]
    GO

    Once this is done, I can go to Flyway Desktop and detect the change. When my schema model refreshes, I see the change, but no filegroup.

    2024-02-09 14_50_41-Flyway Desktop

    Hmmm, what’s wrong?

    By default SQL Compare ignores filegroup information. If I click the Comparison options button, I get a dialog.

    2024-02-09 14_51_29-Flyway Desktop

    In here, go to the Comparison options dialog and type “file”. Hopefully the lower option below will be fixed to say “filegroups” and also add commas soon (sorry, I’m an editor).

    2024-02-09 14_51_42-Flyway Desktop

    We ignore these by default, so I’ll uncheck the lower box.

    2024-02-09 14_53_10-Flyway Desktop

    I’ll save this and refresh my schema model. Now I see the proper script with the ON clause.

    2024-02-09 14_53_27-Flyway Desktop

    Problem solved. If I care about where objects are created, I now have the filegroup location captured as part of my code.

    Try Flyway Enterprise 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:

  • Friday Flyway Tips–Dark Mode

    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. This series looks at some tips I’ve gotten along the way.

    Dark Mode

    In general, I’m not a big dark mode person. I tend to use browsers in light mode, like this:

    2024-02-07 15_17_17-SQLServerCentral – The #1 SQL Server community

    I regularly work in VSCode, which is light for me.

    2024-02-07 15_17_28-SQLSat1076.yml - sqlsatwebsite - Visual Studio Code

    And of course, SSMS is light. I know lots of people have wanted a dark mode, and you can configure that, but it’s a mess. To me, I just like light mode.

    2024-02-07 15_18_10-SQLQuery9.sql - ARISTOTLE.DMDemo_1_Dev (ARISTOTLE_Steve (55))_ - Microsoft SQL S

    However, someone posted a note internally a Redgate thanking engineers for dark mode.

    Wha??? I had to try it.

    It looks interesting.

    2024-02-07 15_20_57-Flyway Desktop

    I don’t know if I’ll use it, but it’s easy to enable, and I can switch anytime. In the top bar, there are a number of icons. There’s a moon for one, which you see above and below, because I’m in dark mode.

    2024-02-07 15_21_45-Flyway Desktop

    If I click the left-most one above, I see this:

    2024-02-07 15_22_05-Flyway Desktop

    Now I have a sun, and a light mode.

    2024-02-07 15_22_18-Flyway Desktop

    This works on all tabs, on the VCS blade, and it gives you the option to work with either a white or dark background.

    That’s pretty cool. I don’t care so much, but I know lots of people do, so they now get the option.

    Try Flyway Enterprise 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:

  • Friday Flyway Tips–Navigating in Flyway Desktop

    Flyway Desktop changed the navigation and a few people were surprised. I was as well, so I decided to do a short tip on the changes.

    This is part of a series of posts on Flyway.

    The Old Flyway Desktop

    If you’ve been following these tips, or worked with the Flyway Enterprise system, you’ve encountered Flyway Desktop, and you might have seen something that looked like this, with the navigation across the top of the screen. We see four “tabs”, called Schema model,
    Generate Migrations, Migrations, and Version Control:

    2023-12-05 15_07_27-Flyway Desktop

    As part of a design refresh, we moved the version control tab to the right side as a bar, which shrinks it, but also gives information while a developer is working. I covered this in a previous tip. You can see that design below.

    2024-01-05 16_41_53-Flyway Desktop

    We weren’t done and I was surprised how quickly we made another change.

    Flyway Desktop v7

    This was actually in v7.0.5, which released Jan 11. We moved all the tabs to the side, though this time the first three moved to the left. As you can see below, I have the migrations tab selected and the nav is on the side panel.

    2024-02-01 16_08_17-Flyway Desktop

    The same three tabs are there, but now on the left, and what’s more, I can shrink this panel to a bar, which gives me more room in which to see code and work with my changes. The VCS tab is still on the right, with icons to let me know when I have changes to push, pull, or fetch.

    2024-02-01 16_09_48-Project Llama Assistant Window

    Summary

    This might not seem like much, but it’s a nice visual change and it gives us the ability to add more features in tabs, without running out of room or squeezing things at the top. Over time, a few more pieces of functionality will appear here as we continue to expand the capabilities of the tool.

    Try Flyway Desktop 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:

  • Friday Flyway Tips–Linking a GitHub Issue to a Code Commit

    Recently I was doing a demo and a customer asked how I had linked my commit in Azure DevOps to the work item that existed. It’s easy, and tldr; it’s with the commit comment. This post shows how that works.

    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.

    Creating an Issue

    Many people use GitHub and adding issues is easy. You go to the Issues tab, click “New” and enter details. What is required might vary by project. I have a public demo project here: https://github.com/way0utwest/FlywayNorthwind

    My issues tab has a few items, but you can see one of the issues below. Note, I’m not proud of this, as I just added this for a demo. I didn’t really add enough detail for anyone to work off this. I’ll do better with other issues.

    2024-01-05 17_01_26-Add a Products Entity · Issue #1 · way0utwest_FlywayNorthwind — Mozilla Firefox

    In any case, the thing to note is I have a #1 at the top, meaning this is issue #1. If I type a comment or note anywhere in this project and include #1, a link is created to this issue.

    Linking A Commit in FWD

    This is very similar to the technique I showed in Azure DevOps. Actually, it’s the same. I’ll make some changes for a products table and generate a migration script. When I go to the Version Control blade, I see the changes and I commit them with a message that includes #1.

    2024-01-05 17_05_11-

    In the GitHub code tab, I see my commit message, and the #1 is hyperlinked. If I hover over it, I see the issue.

    2024-01-05 17_06_13-way0utwest_FlywayNorthwind_ Test project using Northwind and Flyway — Mozilla Fi

    In the Issue itself, I see a flow with the commit listed.

    2024-01-05 17_06_51-Add a Products Entity · Issue #1 · way0utwest_FlywayNorthwind — Mozilla Firefox

    Now I’m not only tracking discussion and comments of the issue, I’m linking commits as well.

    This is less a Flyway Desktop feature than a GitHub one, but you can access this from Flyway Desktop by writing good commit messages with Issue numbers.

    Try Flyway Desktop 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: