2. What is CI?
#sqlinthecity
• Continuous Integration (CI) is a development
practice that requires developers to integrate code
into a shared repository several times a day. Each
check-in is then verified by an automated build,
allowing teams to detect problems early.
3. What is database CI?
• It’s the same!
#sqlinthecity
• Applying the same approach to the database as we
do for the application
4. The road to database CI
1. Source control
2. Automated builds
3. Automated tests
4. Frequent check ins of small changes
#sqlinthecity
5. The road to database CI
1. Source control
2. Automated builds
3. Automated tests
4. Frequent check ins of small changes
#sqlinthecity
6. Advantages of Automated Builds
• Early warning of broken code
• Constant availability of a "current" build
• Don’t continue developing on a broken foundation
• Many more….
#sqlinthecity
7. Goals of today’s workshop
1. Link a source control repository to a build system
2. Use the SQLCI resources to implement build steps that:
• Verify that your database code has built successfully
• Verify an upgrade to an existing database
• Run database unit tests
3. Trigger builds automatically on changes being checked in to
source control
4. Introduce artifacts as the basis for future repeatable
deployments
#sqlinthecity
8. • Plugin for TeamCity
• Part of the Red Gate SQL Automation Pack
• Includes 3 build runners:
• Build
• Sync
• Test
#sqlinthecity
SQLCI Plugin – What is it?
17. The Sync Step…
#sqlinthecity
1. Apply package version
to target database
2. Deployment
validation
(is the target the
same as the
package?)
V1.1
V1.2
compare
24. The road to database CI
1. Source control
2. Automated builds
3. Automated tests
4. Frequent check ins of small changes
#sqlinthecity
25. The road to database CI
1. Source control
2. Automated builds
3. Automated tests
4. Frequent check ins of small changes
#sqlinthecity
26. Advantages of Automated Tests
• Early warning of broken code
• Constant validation of existing functionality
• Detect when new changes introduce errors
• Feedback on the current state of the code
• Many more….
#sqlinthecity
27. SQL Test – What is it?
#sqlinthecity
• Add-in for SQL Server Management Studio
• Builds upon tSQLt framework
• Adds a simple UI for creating, managing and running
database unit tests.
• All tests are written in T-SQL
www.tsqlt.org
32. The Test Step…
#sqlinthecity
1. Build empty test
database from
package
2. Populate a new
database with test
data (optional)
3. Run tSQLt unit tests
(report in JUnit
format)
33. The Test Step…
• Practical
– sqlCI.exe Sync
/package= <values5,2,3>
/databaseServer=<value6>
/databaseName=<value7>
Optionally supply SQL Server Credentials
#sqlinthecity