TeamCity plugin - 1.0
Example: Setting up a database build in TeamCity - TeamCity plugin
This example demonstrates setting up a simple automated TeamCity build to deploy database changes.
In the example, we will set up a build to deploy the latest revision of the source controlled GizmoDev development database to the GizmoTest testing database.
The example has six steps:
- Installing the Red Gate TeamCity plugin
- Creating a new TeamCity project
- Attaching a VCS root
- Adding and configuring the Red Gate build runner
- Adding a VCS trigger
- Making a database change
1. Installing the Red Gate TeamCity plugin
In this example, we will use the Red Gate build runner plugin for TeamCity.
To install the plugin:
- On a computer with TeamCity installed, download the plugin.
This downloads the openMe.zip file which contains RedGateSQLServer.zip.
- Move the RedGateSQLServer.zip file to the plugins folder of the TeamCity data directory. If TeamCity was installed to its default location, the plugins folder is located at:
C:\Users\All Users\JetBrains\TeamCity\plugins.
Note: the location of the plugins folder may be different if TeamCity was not installed in its default location. For more information, see: TeamCity Data Directory (TeamCity documentation).
- In the Windows Start menu search box, type services.msc, and then press Enter:

- In the list of services, right-click TeamCity Web Server, and then click Restart:

You can now use the Red Gate build runner in TeamCity.
2. Creating a new TeamCity project
- In TeamCity Administration, under Projects, click Create project:

- On the Create New Project page, enter a name for the project.
In this example, we will call the project GizmoTest update:

- Click Create.
- Under Build Configurations, click Create build configuration:

- On the Create Build Configuration page, enter a name for the build.
In this example, we will name the build Integration build:

- Click VCS settings.
3. Attaching a VCS root
Once you have created a project, you need to specify the location (VCS root) of your development database in source control.
In this example, we are using SQL Source Control to link our GizmoDev development database to a Subversion (SVN) server.
To attach a VCS root:
- Under Version Control Settings, click Create and attach new VCS root:

- In the Type of VCS box, select the source control system you are using with your development database.
In this example, we are using Subversion.
- Under SVN Connection Settings, in the URL box, we specify the location we want TeamCity to monitor for changes.
In SQL Source Control, the location of a database in source control is displayed on the Setup tab:

You can copy the location by right-clicking the path, and then clicking Copy:

In this example, our location is https://lt-tomc.red-gate.com/svn/Databases/GizmoDev/

If authentication is required for your source control server, you must specify a user name and password.
- Click Test connection.
TeamCity tests the connection to the source control location.
- If the connection is successful, click Save.
The VCS root is created.
4. Adding and configuring the Red Gate build runner
- Click Add Build Step.
- In the Runner type box, select Red Gate (SQL Server):

If your database is located in a subfolder of your VCS root, you must specify a path in the Database folder box. For example, if your VCS root is http://subversion.example.com/ and your database folder location is http://subversion.example.com/AdventureWorks, enter AdventureWorks.
In this example, our VCS root is our database location, so we do not need to specify a database folder.
- Under Continuous Integration setup, specify connection details for your SQL Server.
- Select Update a database on every build, and specify the name of the database you want the build to update.
In this example, we want to update the GizmoTest database:

Note that the database you specify must be an existing database on the server; the build runner does not create the database for you.
- Click Save.
5. Adding a VCS trigger
If we want TeamCity to trigger a build when changes are detected in source control, we need to add a VCS trigger:
- On the Build Configuration page, under Configuration Steps, click Build Triggering:

- On the Build Triggering page, click Add new trigger:

- From the Add new trigger box, select VCS Trigger:

- Click Save.
TeamCity will now run a build when a check-in to your VCS root is detected.
6. Making a database change
Now that the build is set up in TeamCity, we can make a database change to trigger a build.
In this example, we will add a new Image column to our Gizmos table:

We then commit the change using SQL Source Control:

Once the change is commited to source control, TeamCity picks up the change and runs a build. You can view the status of the build by clicking Projects in TeamCity:

For a summary of the log messages printed by the build, or for troubleshooting a failing build, move your cursor over
, and then click Build log:

Was this article helpful?
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

