SQL Source Control v7 Enhancements
Stephanie Herr summarizes what's new in SQL Source Control v7, including support for Git hooks, Git repositories hosted on Azure DevOps, and pre- and post-deployment scripts.
With the v7 release, SQL Source Control now enforces Git hooks, and provides full support for working with Git repositories hosted on Azure DevOps. It also comes with pre- and post-deployment scripts to make it easier to automate the build and deploy new database versions to your pre-production or production servers.
Finally, the latest release continues SQL Source Control’s long-standing commitment to keep pace with SSMS improvements, with support for the public preview of SSMS 18.
Better Git Support
Source control is the fundamental tool that enables team collaboration during development. It allows each developer to share changes quickly, see a revision history of all changes, revert to a previous revision, and to enforce standard source control policies and checks. Git has long been the most widely-used of the source control systems that SQL Source Control supports.
SQL Source Control plugs directly into SQL Server Management Studio (SSMS) and provides database developers with an efficient interface between their local, working copy of the database, in SSMS and their local and remote source control repositories.
When working with Git, each developer works on their own sandbox database, committing tested changes to their local Git repository, and then sharing them with others by pushing changes to the remote team repository, as well updating their own work frequently by pulling down and merging the changes made by others.
SQL Source Control v7 fixes the previous authentication problems that meant that users previously had to leave SSMS and use a Git tool, or the Git command line, in order to push to or pull from a Git repository hosted on Azure DevOps (previously called TFS/VSTS).
In addition, SQL Source Control now supports Git Hooks, which allow users to specify scripts that git will call before or after running certain git commands (such as a commit, or a push). The hooks allow the team to enforce compliance with their own policies and rules. For example, some users set up hooks to require that each commit has an associated comment, or a story or bug ID
SQL Source Control v7 now enforces these hooks (previous version ignored them). You will need Git for Windows installed on the machine that has SQL Source Control. If it’s not installed, you will be notified when linking new databases or trying to Commit/Get Latest/View History on databases already linked to Git.
Pre- and post-deployment scripts
The primary purpose of SQL Source Control is to make it as easy as possible to get a database under version control, and then commit and share all subsequent changes. However, it also assists with the various database build and deployment processes that the source control system must support, such as rebuilding a database in any pre-production environment, at any version, or deploying version ‘x’ to version ‘x+1’ or rolling back to a previous version.
SQL Source Control v7 now supports pre- and post-deployment scripts that give you additional flexibility when you are automating your database deployments. You can use them to set up database level settings like configuration settings or creating filegroups. You can also use the built-in SQL Server variable @@SERVERNAME
to customize where the scripts run and have different SQL statements for different environments. This can be useful for managing permissions and adding different users into roles in different environments or handling data that is different across the environments.
In previous versions, users had to manage their own scripts and orchestrate this via their release management system, which took more time to set up. Now, you can do everything right in SQL Source Control and it will be picked up in manual deployments with SQL Compare or automated deployments with SQL Change Automation. There are some great examples about using Pre and Post deployment scripts in the documentation.
Upgrading to SQL Source Control v7
For existing SQL Source Control users, you will find v7 when Checking for Updates in the SQL Source Control Help menu within SSMS. For new users, you can get SQL Source Control from the Product page. We hope you enjoy SQL Source Control v7; please visit our forum to post any feedback or requests.