4. AGENDA
• About presenter
• What is continuous database
deployment?
• Delivery Methods
• Environment Refreshes
• Best Practices
• Questions/Discussion
5. MIKE ACORD
Senior full-stack software engineer
with over 15 years’ experience
developing leading-edge
technologies. Also experienced in
.Net, SQL Server, DevOps and
SharePoint. Currently an application
developer at TASC (Total
Administrative Services Corp).
6. CONTINUOUS DEPLOYMENTS
YEAH, WE DO THAT!!
We continuously deploy our code, DevOps all the things!
• Automated Deployments
• Integration Tests
• Build Pipeline
• And databases?????
• … crickets
7. INSTEAD WE
MANUALLY APPLY CHANGE SCRIPTS
MANUALLY RUN SCHEMA COMPARISONS
BUT
• Error Prone
• Risky
• Slow
8. SO WHAT IS IT?
CONTINUOUS DATABASE DEPLOYMENT
• Automated deployments
• Integration tests
• Build Pipeline
9. BENEFITS
CONTINUOUS DATABASE DEPLOYMENT
• Deployments are less error prone and more
repeatable
• Anyone on team can do deploys
• Testable – can re-deploy to environments
• Faster to release
• Easier to merge branches
• Easier to refresh environments
10. METHODS
WAYS TO IMPLEMENT
• Schema based – current schema always in source
control
• Script based – change scripts checked in and applied
• Code based – code database changes to be applied
11. SCHEMA BASED
DATABASE SCHEMA IN SOURCE CONTROL
• Provides a history of schema
• Ability to generate change scripts to reverse changes
• Less likely to screw up change scripts
• Compare and sync schema to deploy changes
• Can make to database and sync back to model
Challenges:
• Merging can be challenging
• Black voodoo magic may not create best change scripts
• Deployment process more complex
• Forget to check in changes and lose them
16. SCRIPT BASED
CREATE CHANGE SCRIPTS TO APPLY
• Simple to understand and follow
• Easy to implement
• Does not do any back magic
• Easy to test scripts
Challenges:
• May need to review change scripts
• No ‘current’ database that you can deploy
19. CODE BASED
CODE DATABASE CHANGES
• Allow quick setup for new developers
• Allows for seed data
• Simple to use
• Can generate change scripts
Challenges
• Testing changes can be awkward
• May feel unnatural
• Rolling deployments may be more challenging
21. DATABASE REFRESH
KEEP DATA CURRENT
• Ability to quickly refresh environments from production
• Can be scheduled to happen daily
• Allows better diagnosis of data issues
• Daily testing of deployment scripts
Challenges:
• Clustered servers
• Large databases
23. BEST PRACTICES
• Create backups or snapshots
• Avoid data loss
• Deploy breaking changes in steps
Example – for a field rename you can:
• Add new field with synchronization trigger
• Modify application to use new column
• Remove old column and synchronization trigger
More info: http://www.agiledata.org/essays/renameColumn.html
http://www.ambysoft.com/books/refactoringDatabases.html