#sqlinthecity

Best Practices for
Database Deployments
Grant Fritchey
Red Gate Software
#sqlinthecity

Goals
• Understand how to create your own deployment
mechanisms
• Learn about the tools available for autom...
#sqlinthecity

The Database “Problem”
• Information persistence layer
• Businesses like their data
• Keeping that data in ...
#sqlinthecity

The Database “Solution”
• Treat it as much like code as possible
• Do the following
– Work directly with th...
Process: Team Glue
• You must define a process
– It’s your process, you define it
• Management buy-in
• Write the process ...
#sqlinthecity

Development Process

Production

QA/Testing

Development
#sqlinthecity

Building a Deployment Process

Production

QA/Testing

Development
#sqlinthecity

Building a Deployment Process
•
•
•
•
•
•
•

Production deployment script
Test script on copy of production...
#sqlinthecity

Source Control
• Two known states
– Production
– Source Control
• Ensures coupling between application and
...
#sqlinthecity

Demo
#sqlinthecity

Testing Deployments
• ABCD
– Always Be Continuously Deploying
• Unit Testing
• Continuous Integration
• Cop...
#sqlinthecity

Demo
#sqlinthecity

Deploying to Multiple Environments
• Multiple moves between multiple environments
• Every deployment is pra...
#sqlinthecity

Deploying to Multiple Environments
• Multiple moves between multiple environments
• Every deployment is pra...
#sqlinthecity

Deploying to Multiple Environments
• Multiple moves between multiple environments
• Every deployment is pra...
#sqlinthecity

Deploying to Multiple Environments
• Multiple moves between multiple environments
• Every deployment is pra...
#sqlinthecity

Demo
#sqlinthecity

Integrating Database with Application
•
•
•
•

Coupled through source control
Labeled together
Deployed tog...
#sqlinthecity

Demo
#sqlinthecity

Deployment Automation
•
•
•
•

Remove humans from the equation
Speed the process
Make the process repeatabl...
#sqlinthecity

Summary
•
•
•
•
•
•

Define a process
Work backwards from production
All database code in source control
In...
#sqlinthecity

Goals
• Understand how to create your own deployment
mechanisms
• Learn about the tools available for autom...
Upcoming SlideShare
Loading in …5
×

Best Practices for Database Deployments

682 views

Published on

Best Practices for Database Deployments. SQL In The City Cambridge presentation by Grant Fritchey, Red Gate Software

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Best Practices for Database Deployments

  1. 1. #sqlinthecity Best Practices for Database Deployments Grant Fritchey Red Gate Software
  2. 2. #sqlinthecity Goals • Understand how to create your own deployment mechanisms • Learn about the tools available for automation of the deployment process • Acquire the knowledge of how to test your deployments
  3. 3. #sqlinthecity 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” 3
  4. 4. #sqlinthecity The Database “Solution” • Treat it as much like code as possible • Do the following – Work directly with the development 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 4
  5. 5. 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 5
  6. 6. #sqlinthecity Development Process Production QA/Testing Development
  7. 7. #sqlinthecity Building a Deployment Process Production QA/Testing Development
  8. 8. #sqlinthecity Building a Deployment Process • • • • • • • Production deployment script Test script on copy of production Generate script for production from label Label code in source control Add changes to source control Make changes to code Get code from source control
  9. 9. #sqlinthecity Source Control • Two known states – Production – Source Control • Ensures coupling between application and database • History of changes • Auditing
  10. 10. #sqlinthecity Demo
  11. 11. #sqlinthecity Testing Deployments • ABCD – Always Be Continuously Deploying • Unit Testing • Continuous Integration • Copies of production
  12. 12. #sqlinthecity Demo
  13. 13. #sqlinthecity Deploying to Multiple Environments • Multiple moves between multiple environments • Every deployment is practice
  14. 14. #sqlinthecity Deploying to Multiple Environments • Multiple moves between multiple environments • Every deployment is practice
  15. 15. #sqlinthecity Deploying to Multiple Environments • Multiple moves between multiple environments • Every deployment is practice
  16. 16. #sqlinthecity Deploying to Multiple Environments • Multiple moves between multiple environments • Every deployment is practice
  17. 17. #sqlinthecity Demo
  18. 18. #sqlinthecity Integrating Database with Application • • • • Coupled through source control Labeled together Deployed together Database is deployed first
  19. 19. #sqlinthecity Demo
  20. 20. #sqlinthecity Deployment Automation • • • • Remove humans from the equation Speed the process Make the process repeatable Take advantage of the tools you know
  21. 21. #sqlinthecity Summary • • • • • • Define a process Work backwards from production All database code in source control Integrate tightly with development team Test and validate all code Automate as much as possible
  22. 22. #sqlinthecity Goals • Understand how to create your own deployment mechanisms • Learn about the tools available for automation of the deployment process • Acquire the knowledge of how to test your deployments

×