SlideShare a Scribd company logo
Ernest Hwang
Principal Software Engineer, Practice Fusion
http://practicefusion.com/careers/
Who am I?
• Ernest Hwang, Principal Software Engineer
at Practice Fusion in San Francisco (We’re Hiring!)
• C#, .NET Developer since 2001
• SQL Server Developer since 1999 (SQL Server 6.x)
• Using Red Gate for Continuous Integration since June
2011
About Practice Fusion
Why am I here?
What is this?
A “How To” guide for automating your day-to-day
maintenance tasks by…
• *Easily* Versioning your database using Red Gate
SQL Source Control
• Using Continuous Integration (via Jenkins) to validate
Database builds
• Using Jenkins to automate database deployments
• Using CI / tSQLt / SQL Test to run unit tests
Prerequisites
• Experience with source control management systems
(svn, TFS, git, Hg)
• Familiarity with Continuous Integration Products
(Jenkins, Team City, Cruise Control)
• Awareness of build scripting languages (ant,
MSBuild)
What software is used?
•
•
•
•
•
–
–
–
–
•

SQL Server 2008 / 2012
Red Gate SQL Source Control
Red Gate SQL Compare
Red Gate SQL Data Compare
Jenkins Continuous Integration Server
http://jenkins-ci.org/
Promoted Build Plugin
Copy Artifacts Plugin
Version Plugin
Git Plugin
MSBuild
What is SQL Source Control
• Source Control plug in for SQL Server
Management Studio
• Creates a “snapshot” of the database schema
defined by CREATE scripts
• Snapshot is consumable by SQL Compare and
may be used to compare against the schema of
an actual database
What is SQL Source Control?
SQL Source Control is to SSMS
as
TortoiseSVN is to Windows Explorer
Demo Environment
GitHub

Developer Workstation

Local Copy of
RGDemo database

Build and Database Server
(Windows Azure VM)

Dev, QA, & Prod
Databases
Commiting Changes to Source Control
Demo

Local Database
Changes

Commit Changes
via SQL Source
Control

Changes committed to
SCM repository
How does Continuous Integration fit
in?
• The CI server polls the repository for changes
• When changes are checked in, the CI job kicks off
– Verifies that the database can be built
• Builds a brand new database from scratch using SQL
Compare and SQL Data Compare
– Runs unit tests
• Build should fail if unit tests do not succeed
– Archives the artifacts (for deployments)
• Artifacts can include build/test reports
– Emails engineers if there are problems
I’M THE ONE WHO DROPS TABLES!
(demo)
Deploying Changes to Different
Environments
• The Promoted Builds plug in can be used to
deploy changes to
Integration/QA/Staging/Production environments
• SQL Compare and SQL Data Compare are
used to deploy changes between the sourced
controlled database and your development
environments
• Deploying to Production and/or Staging can be
configured to just create the scripts as opposed
to forcing the synchronization
Deploying to Dev / QA
Demo

SQL Source Control
Repository

SQL Compare

Development Environment
Database
Creating a Database “Version”
• Make sure the Jenkins Versioning plugin is
installed
• Create a User Defined Function called
dbo.DATABASE_VERSION()
• Create a build step that updates the UDF with
the version number
• The updated UDF will be archived and used with
deployments
Versioning your Database
Demo

Commit Changes
via SQL Source
Control

CI Server Detects
Changes
Kicks off Build
Process

Build Task updates
dbo.DATABASE_VERSION()
Function

Updated UDF
Archived
Unit Testing with tSQLt and SQL Test
• tSQLt is an open source set of stored procedures and
functions to facilitate Unit Testing in SQL databases
• SQL Test is a wrapper around this framework that
integrates with SSMS
• Your build server can enforce that your unit tests pass
and generate reports
Unit Testing with tSQLt / SQL Test
Demo

Commit Changes
via SQL Source
Control

CI Server Detects
Changes
Kicks off Build
Process

Build Task executes
Unit Test procedures

Tests can pass or
fail the build
Migrations
Springer’s Final Thought
• Saves developers time (yay!)
– No more maintaining update scripts
– Don’t need to deploy scripts when QA needs changes
• Identifies holes in your deployment process
– Are developers or DBAs making changes directly to
production?
– Are indexes/constraints missing from your
Dev/QA/Prod environments?
• Creates a definitive database build that can be easily
deployed and redeployed
Considerations
• Environments must be pristine
• Process must be changed and understood
• Production change scripts should be scrutinized
(especially for the first few releases)
• Migration Scripts can be used to massage data
• DB Replication requires more work for
promotions
Appendix 1: Other CI Servers
•
•
•
•

Jenkins (open source)
Team City (JetBrains)
Bamboo (Atlassian)
CruiseControl / CruiseControl.NET (open source)
Appendix 2: Other Source Control
Systems
•
•
•
•
•
•

Subversion (SVN)
Git
Team Foundation Server
Mercurial (Hg)
AccuRev
Surround SCM
Links / Contact Info
•
•
•

ehwang@practicefusion.com
@ernestedcode
https://github.com/CF9/Databases.RGDemo

•

Practice Fusion is Hiring (email me)
http://practicefusion.com/careers/
facebook.com/practicefusion
@practicefusion

•
•

More Related Content

PPTX
Database automated build and test - SQL In The City Cambridge
PDF
Microsoft SQL Server Continuous Integration
PPT
Brightcove presentation on Automated Testing
PPTX
Validating latest changes with XCI
PDF
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
PPTX
How to contribute to an open source project and don’t die during the Code Rev...
PDF
2016 09-dev opsjourney-devopsdaysoslo
PDF
Sencha Roadshow 2017: What's New in Sencha Test
Database automated build and test - SQL In The City Cambridge
Microsoft SQL Server Continuous Integration
Brightcove presentation on Automated Testing
Validating latest changes with XCI
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
How to contribute to an open source project and don’t die during the Code Rev...
2016 09-dev opsjourney-devopsdaysoslo
Sencha Roadshow 2017: What's New in Sencha Test

What's hot (20)

PPTX
Everything as Code with Azure DevOps
PDF
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
PDF
Working with FME in an Agile Software Development Lifecycle
PPTX
How to setup a development environment for ONAP
PPTX
Continuous Integration and Delivery using TeamCity and Jenkins
PPTX
You don’t need DTAP + Backbase implementation - Amsterdam 17-12-2015
PPTX
Working Well Together: How to Keep High-end Game Development Teams Productive
PPTX
Continuous Delivery with Chef and GoCD
PPT
Test eng-meetup-taki take
PDF
Introduction to Enterprise-Release Engineering on the Salesforce Platform
PDF
Build Your Custom Performance Testing Framework
PPTX
Power shell saturday ravikanth
PPTX
CI_CD_Demo.pptx
PPTX
Jenkins introduction
PPTX
Test automation proposal
PPT
Acquia presented at MassTLC event on automated testing
PDF
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
PPTX
Dev/Test scenarios in DevOps world
PPTX
Five Real-World Strategies for Perforce Streams
PPTX
A Report on Web Application Framework Benchmarks and Perl's Performance
Everything as Code with Azure DevOps
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Working with FME in an Agile Software Development Lifecycle
How to setup a development environment for ONAP
Continuous Integration and Delivery using TeamCity and Jenkins
You don’t need DTAP + Backbase implementation - Amsterdam 17-12-2015
Working Well Together: How to Keep High-end Game Development Teams Productive
Continuous Delivery with Chef and GoCD
Test eng-meetup-taki take
Introduction to Enterprise-Release Engineering on the Salesforce Platform
Build Your Custom Performance Testing Framework
Power shell saturday ravikanth
CI_CD_Demo.pptx
Jenkins introduction
Test automation proposal
Acquia presented at MassTLC event on automated testing
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
Dev/Test scenarios in DevOps world
Five Real-World Strategies for Perforce Streams
A Report on Web Application Framework Benchmarks and Perl's Performance
Ad

Similar to Database Build and Release - SQL In The City - Ernest Hwang (20)

PPTX
#DOAW16 - DevOps@work Roma 2016 - Databases under source control
PPT
Database continuous integration, unit test and functional test
PPTX
Part of the DLM Story: Automated database build and test with TeamCity
PDF
KoprowskiT_Session2_SDNEvent_SourceControlForDBA
PPTX
Sql source control
PPTX
Getting CI right for SQL Server
PPTX
Continuous integration sql in the city
PDF
Database CI Demo Using Sql Server
PDF
Automated Build and Test (for Continuous Integration) - David Atkinson - SQL ...
PPTX
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
PPTX
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
PPTX
DevOps+Data: Working with Source Control
PPTX
Database CI/CD Pipeline
PPTX
Bringing DevOps to the Database
PPT
Database Change Management
PDF
Using Redgate, AKS and Azure to bring DevOps to your Database
PDF
Using Redgate, AKS and Azure to bring DevOps to your database
PPTX
Database Deployment Pipeline - SQL In The City Workshop 2014
PPTX
Building an automated database deployment pipeline
PPTX
Continuous Integration for OpenVMS with Jenkins
#DOAW16 - DevOps@work Roma 2016 - Databases under source control
Database continuous integration, unit test and functional test
Part of the DLM Story: Automated database build and test with TeamCity
KoprowskiT_Session2_SDNEvent_SourceControlForDBA
Sql source control
Getting CI right for SQL Server
Continuous integration sql in the city
Database CI Demo Using Sql Server
Automated Build and Test (for Continuous Integration) - David Atkinson - SQL ...
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
DevOps+Data: Working with Source Control
Database CI/CD Pipeline
Bringing DevOps to the Database
Database Change Management
Using Redgate, AKS and Azure to bring DevOps to your Database
Using Redgate, AKS and Azure to bring DevOps to your database
Database Deployment Pipeline - SQL In The City Workshop 2014
Building an automated database deployment pipeline
Continuous Integration for OpenVMS with Jenkins
Ad

More from Red Gate Software (20)

PDF
The future of DevOps: fully left-shifted deployments with version control and...
PDF
Embracing DevOps through database migrations with Flyway
PPTX
Database DevOps for Managed Service Providers
PDF
Mizuho Financial: Launching our Database DevOps journey
PDF
7 steps to effective SQL Server monitoring
PDF
Level up your deployments for SQL Source Control
PDF
Key findings from the 2020 state of database dev ops report
PPTX
Extend DevOps to Your SQL Server Databases
PDF
2019 year in review slides
PPTX
What we learned at PASS Summit in 2019
PPTX
Quality in Software Development: Anglia Ruskin University
PPTX
How SQL Change Automation helps you deliver value faster
PPTX
DevOps essentials from Abel Wang and Steve Jones
PPTX
Successfully migrating existing databases to Azure
PPTX
The Ultimate Guide to Choosing and Implementing the Right Monitoring Tool
PDF
Everything You Need to Know About the 2019 DORA Accelerate State of DevOps Re...
PDF
How to Pitch a Software Development Initiative and Ignite Culture Change
PDF
Taming the Wild West
PDF
Standardize Database Development Across your Organization in 4 Key Steps
PDF
Data Privacy Next Steps -Compliant Database DevOps
The future of DevOps: fully left-shifted deployments with version control and...
Embracing DevOps through database migrations with Flyway
Database DevOps for Managed Service Providers
Mizuho Financial: Launching our Database DevOps journey
7 steps to effective SQL Server monitoring
Level up your deployments for SQL Source Control
Key findings from the 2020 state of database dev ops report
Extend DevOps to Your SQL Server Databases
2019 year in review slides
What we learned at PASS Summit in 2019
Quality in Software Development: Anglia Ruskin University
How SQL Change Automation helps you deliver value faster
DevOps essentials from Abel Wang and Steve Jones
Successfully migrating existing databases to Azure
The Ultimate Guide to Choosing and Implementing the Right Monitoring Tool
Everything You Need to Know About the 2019 DORA Accelerate State of DevOps Re...
How to Pitch a Software Development Initiative and Ignite Culture Change
Taming the Wild West
Standardize Database Development Across your Organization in 4 Key Steps
Data Privacy Next Steps -Compliant Database DevOps

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Modernizing your data center with Dell and AMD
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced IT Governance
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
Cloud computing and distributed systems.
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Modernizing your data center with Dell and AMD
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
Advanced IT Governance
Per capita expenditure prediction using model stacking based on satellite ima...
The AUB Centre for AI in Media Proposal.docx
Empathic Computing: Creating Shared Understanding
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Review of recent advances in non-invasive hemoglobin estimation
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
GamePlan Trading System Review: Professional Trader's Honest Take

Database Build and Release - SQL In The City - Ernest Hwang

  • 1. Ernest Hwang Principal Software Engineer, Practice Fusion http://practicefusion.com/careers/
  • 2. Who am I? • Ernest Hwang, Principal Software Engineer at Practice Fusion in San Francisco (We’re Hiring!) • C#, .NET Developer since 2001 • SQL Server Developer since 1999 (SQL Server 6.x) • Using Red Gate for Continuous Integration since June 2011
  • 4. Why am I here?
  • 5. What is this? A “How To” guide for automating your day-to-day maintenance tasks by… • *Easily* Versioning your database using Red Gate SQL Source Control • Using Continuous Integration (via Jenkins) to validate Database builds • Using Jenkins to automate database deployments • Using CI / tSQLt / SQL Test to run unit tests
  • 6. Prerequisites • Experience with source control management systems (svn, TFS, git, Hg) • Familiarity with Continuous Integration Products (Jenkins, Team City, Cruise Control) • Awareness of build scripting languages (ant, MSBuild)
  • 7. What software is used? • • • • • – – – – • SQL Server 2008 / 2012 Red Gate SQL Source Control Red Gate SQL Compare Red Gate SQL Data Compare Jenkins Continuous Integration Server http://jenkins-ci.org/ Promoted Build Plugin Copy Artifacts Plugin Version Plugin Git Plugin MSBuild
  • 8. What is SQL Source Control • Source Control plug in for SQL Server Management Studio • Creates a “snapshot” of the database schema defined by CREATE scripts • Snapshot is consumable by SQL Compare and may be used to compare against the schema of an actual database
  • 9. What is SQL Source Control? SQL Source Control is to SSMS as TortoiseSVN is to Windows Explorer
  • 10. Demo Environment GitHub Developer Workstation Local Copy of RGDemo database Build and Database Server (Windows Azure VM) Dev, QA, & Prod Databases
  • 11. Commiting Changes to Source Control Demo Local Database Changes Commit Changes via SQL Source Control Changes committed to SCM repository
  • 12. How does Continuous Integration fit in? • The CI server polls the repository for changes • When changes are checked in, the CI job kicks off – Verifies that the database can be built • Builds a brand new database from scratch using SQL Compare and SQL Data Compare – Runs unit tests • Build should fail if unit tests do not succeed – Archives the artifacts (for deployments) • Artifacts can include build/test reports – Emails engineers if there are problems
  • 13. I’M THE ONE WHO DROPS TABLES! (demo)
  • 14. Deploying Changes to Different Environments • The Promoted Builds plug in can be used to deploy changes to Integration/QA/Staging/Production environments • SQL Compare and SQL Data Compare are used to deploy changes between the sourced controlled database and your development environments • Deploying to Production and/or Staging can be configured to just create the scripts as opposed to forcing the synchronization
  • 15. Deploying to Dev / QA Demo SQL Source Control Repository SQL Compare Development Environment Database
  • 16. Creating a Database “Version” • Make sure the Jenkins Versioning plugin is installed • Create a User Defined Function called dbo.DATABASE_VERSION() • Create a build step that updates the UDF with the version number • The updated UDF will be archived and used with deployments
  • 17. Versioning your Database Demo Commit Changes via SQL Source Control CI Server Detects Changes Kicks off Build Process Build Task updates dbo.DATABASE_VERSION() Function Updated UDF Archived
  • 18. Unit Testing with tSQLt and SQL Test • tSQLt is an open source set of stored procedures and functions to facilitate Unit Testing in SQL databases • SQL Test is a wrapper around this framework that integrates with SSMS • Your build server can enforce that your unit tests pass and generate reports
  • 19. Unit Testing with tSQLt / SQL Test Demo Commit Changes via SQL Source Control CI Server Detects Changes Kicks off Build Process Build Task executes Unit Test procedures Tests can pass or fail the build
  • 21. Springer’s Final Thought • Saves developers time (yay!) – No more maintaining update scripts – Don’t need to deploy scripts when QA needs changes • Identifies holes in your deployment process – Are developers or DBAs making changes directly to production? – Are indexes/constraints missing from your Dev/QA/Prod environments? • Creates a definitive database build that can be easily deployed and redeployed
  • 22. Considerations • Environments must be pristine • Process must be changed and understood • Production change scripts should be scrutinized (especially for the first few releases) • Migration Scripts can be used to massage data • DB Replication requires more work for promotions
  • 23. Appendix 1: Other CI Servers • • • • Jenkins (open source) Team City (JetBrains) Bamboo (Atlassian) CruiseControl / CruiseControl.NET (open source)
  • 24. Appendix 2: Other Source Control Systems • • • • • • Subversion (SVN) Git Team Foundation Server Mercurial (Hg) AccuRev Surround SCM
  • 25. Links / Contact Info • • • [email protected] @ernestedcode https://github.com/CF9/Databases.RGDemo • Practice Fusion is Hiring (email me) http://practicefusion.com/careers/ facebook.com/practicefusion @practicefusion • •