Automated Rebaselining with SQL Change Automation Clones

In this 20 minute video, we share an easy way to automate "rebaselining" in a database DevOps CI/CD workflow. Follow the video or simply check out the scripts.

There are multiple benefits to using a lightweight clone of your database as the “baseline” in SQL Change Automation. Using images and clones as your baseline:

  1. Shifts deployment validation left by verifying changes against a copy of production
  2. Makes data protection automatic for developers, as data masking is embedded in the image creation process
  3. Makes it easily to rebaseline the image of production as development work continues

This video discusses the rebaselining process, and shows how PowerShell scripts can automate the process of rotating the image used as your baseline. Links to chapters and the scripts shown are right below the video.

Want to work with the scripts?

The PowerShell scripts shown in the repo are here: https://github.com/LitKnd/DontTypeInADemo/tree/main/_powershell/clone

Short on time?

Here’s a table of contents for the video if you’d like to skip to a specific chapter:

  • 00:00 – About SQL Change Automation and clone baselines
  • 02:29 – Creating a new migration so that our baseline is out of date
  • 05:12 – How the baseline image is managed in the .sqlproj file, and why I prefer the approach of rotating an image but keeping the same image name
  • 08:00 – Using PowerShell to create a new image in SQL Clone
  • 10:56 – Using PowerShell to rename images in SQL Clone
  • 12:26 – Using PowerShell to move clones between images in SQL Clone, and implications of “resetting” clones when moving them
  • 16:44 – Showing SQL Change Automation working after image rotation
  • 17:17  – Showing the contents of the updated image via a newly created clone

Looking for setup info?

For additional info on setting up a new project, check out:

Tools in this post