1 / 18

T-SQL Deployment and Continuous Integration Best Practices

Learn the importance of source control for databases in a development environment, comply with code development best practices, and incorporate testing and continuous integration into database development processes.

darrellm
Download Presentation

T-SQL Deployment and Continuous Integration Best Practices

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. T-SQL Deployment and Continuous Integration Best Practices Grant Fritchey – Red Gate Software

  2. Goals • Learn the importance of source control for databases in a database team development environment • Show how database development can comply with code development best practices • Learn how to incorporate testing and support of a continuous integration environment into database development processes

  3. Grant Fritchey • Product Evangelist for Red Gate Software • Email: grant@scarydba.com • Twitter: @gfritchey • Blog: scarydba.com

  4. The Database “Problem” • Information persistence layer • Businesses like their data • Keeping that data in place can be work • Which is the start of the “problem” • Object Relational Impedance Mismatch • Which is the rest of the “problem”

  5. The Database “Solution” • Treat it as much like code as possible • Do the following • Work directly with the team • Define a repeatable process • Put the database into source control • Put tests in place to validate the database • Automate as much of the process as possible • Follow the local development paradigm as much as possible

  6. The Team • Roles • Application Developer • Database Developer • Database Administrator • Report Writer • ? • Communication • Collaboration • Remember, it’s a common goal • Contention

  7. Process: Team Glue • You must define a process • It’s your process, you define it • Management buy-in • Write the process down • And publish it • Review process regularly • Follow the process • Exceptions have to be exceptional • The process applies to everyone • No, DBAs, you’re not that special

  8. Source Control • Known states • Production • Source control • Tighter integration with Developers • History of changes • Auditing • But, requires discipline • Always work through source control • Always deploy from source control • Only deploy from source control

  9. Testing • Test Driven development • Improved quality • Continuous integration • Testing needs • Automation • Isolation • Repeatability

  10. Automation • Because you have work to do • Multiple developers • Multiple servers • Tools you know • TSQL • Powershell • Command line • 3rd Party

  11. Continuous Integration • Quality control • Identify issues early • Build from source control • Automatic process • Scheduled or Triggered • Make the build self-testing • Publish the results

  12. Continuous Integration runs each time you commit a change to source control • Unit test database code • Validate database upgrade scripts • Validate database creation scripts • Generate database upgrade scripts • Generate creation scripts • We also build a database that can be used by the application for its own unit tests • Optionally build and update dev and test environments If any part of the CI process fails, the ‘build’ is deemed broken and developers are alerted immediately Each time the build is successful, publish updated database documentation

  13. Tool Set • Source Control • Flavors don’t matter • Make it work for you • Use labeling (or equivalent) • Use branching (or equivalent) • Build Tool • SSMS • Visual Studio • 3rd Party • CI Monitoring Tool • TeamCity • CruiseControl • Custom • Other

  14. Demo • More than one way to do this

  15. Goals • Learn the importance of source control for databases in a database team development environment • Show how database development can comply with code development best practices • Learn how to incorporate testing and support of a continuous integration environment into database development processes

  16. Resources • Scarydba.com/resources • http://knowscrum.com/benefits-of-continuous-integration-in-scrum-best-practices-in-scrum/ - Benefits of CI in Scrum • http://www.codinghorror.com/blog/2006/10/the-build-server-your-projects-heart-monitor.html - The Build Server, Your Projects Heart Monitor • http://martinfowler.com/articles/continuousIntegration.html - Martin Fowler on CI • http://en.wikipedia.org/wiki/Continuous_integration- Wikipedia CI • http://www.real-sql-guy.com/search/label/Source%20Control – Automated Source Control • http://www.simple-talk.com/sql/sql-tools/sql-test-seeing-red-change-to-green/- Rob Sullivan – Seeing Red Change to Green • http://www.simple-talk.com/content/article.aspx?article=1247– Troy Hunt – Continuous Integration for SQL Server Databases

  17. Grant Fritchey • Product Evangelist for Red Gate Software • Email: grant@scarydba.com • Twitter: @gfritchey • Blog: scarydba.com

  18. Questions? How would you… ? What happens when… ? Why does… ? When do I… ?

More Related