This will make it very easy to deploy the same, tested packages to your other environments. You can also deploy the NuGet package with your favourite deployment tool such as Red Gate Deployment Manager or Octopus Deploy. Your NuGet package is saved in the TeamCity NuGet feed by default but you can publish it to a different feed if you like using a ‘NuGet Publish’ build step. Following the build step you can run test and sync in any combination or order, for example running the tests on different editions of SQL Server or updating several different test databases to ensure they are all in sync with the latest (successful) version from source control. The former can be used to automate any tSQLt unit tests that you have and the latter can be used to deploy your package to another environment.īoth these steps should be run after the ‘Red Gate SQL CI Build’ step as they will use the package created in your build as a source. You will notice that there are two other types of build step that come with the Red Gate TeamCity integration: ‘Red Gate SQL CI Test’ and ‘Red Gate SQL CI Sync’. If you are still struggling please contact me and I can help. If you are struggling in any area there is a more detailed worked example available on the official documentation site. Stop the stopwatch and comment with your time!Īlso, you might want to test it by running the build manually or committing something to your VCS. Go to Build Triggers and add a VCS commit trigger.ĭone. If you don’t you can get away with less.)ĥ.
(If you use encrypted objects you need sa. Give the build step access to a SQL Server instance with enough creds to build a database. If the tests are successful you can deploy the package with your deployment tool).Ĥ. (This is a NuGet package that can be re-used by following build steps to further test your code. Add a new build step to your project and select the Red Gate SQL CI Build option.ģ. Add a new project ensuring that you add the VCS root where you are saving your database scripts.Ģ. Step 3: Add a project in TeamCity and configure a build stepġ. %ALLUSERSPROFILE%\JetBrains\TeamCity\pluginsĬ:\ProgramData\JetBrains\TeamCity\pluginsĤ. Copy sqlci-teamcity.zip into the plugins folder of the TeamCity data directory. Select ‘Open Folder’ under the TeamCity section in ‘Automation tools’.ģ. Fire up “Intro to SQL Automation Pack”.Ģ. Step 2: Copy the TeamCity plug-in into the TeamCity data directoryġ.
? Step 1: Download and install the SQL Automation Pack Oh – and leave a comment to let me know your time. So you still don’t believe me? Prove me wrong: Go to, select ‘stopwatch’ and ‘start’ and then continue reading. So you don’t believe it can be done in 10 minutes? These people I did it yesterday in about that time. (If you are using any other CI server you should read this post instead since you’ll want to follow the approach I recommended for Jenkins.) If you already use TeamCity and either you already source control your Visual Studio DB proj or you use SQL Source Control, setting up automated database builds now takes under 10 minutes.
Red Gate just released an updated version of its TeamCity plug-in. If you need persuading of the benefits read this.īut most of us don’t do it. This is just as true for our database as it is for our code.
We all know we should be building our code upon every commit to our version control system (VCS).