Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Continuous database deployment

344 views

Published on

Learn the best practices and methods to implement continuous database delivery.

Published in: Software
  • Login to see the comments

  • Be the first to like this

Continuous database deployment

  1. 1. CONTINUOUS DATABASE DEPLOYMENTS ZERO TO HERO PRESENTED BY: MIKE ACORD
  2. 2. AGENDA • About presenter • What is continuous database deployment? • Delivery Methods • Environment Refreshes • Best Practices • Questions/Discussion
  3. 3. 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).
  4. 4. CONTINUOUS DEPLOYMENTS YEAH, WE DO THAT!! We continuously deploy our code, DevOps all the things! • Automated Deployments • Integration Tests • Build Pipeline • And databases????? • … crickets
  5. 5. INSTEAD WE MANUALLY APPLY CHANGE SCRIPTS MANUALLY RUN SCHEMA COMPARISONS BUT • Error Prone • Risky • Slow
  6. 6. SO WHAT IS IT? CONTINUOUS DATABASE DEPLOYMENT • Automated deployments • Integration tests • Build Pipeline
  7. 7. 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
  8. 8. 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
  9. 9. 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 
  10. 10. SCHEMA BASED SQL SOURCE CONTROL
  11. 11. SCHEMA BASED VISUAL STUDIO DATABASE PROJECT
  12. 12. SCHEMA BASED EXAMPLE – VS DATABASE PROJECT + SQL PACKAGE
  13. 13. 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
  14. 14. SCRIPT BASED EXAMPLE DBUP + OCTOPUS DEPLOY
  15. 15. 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
  16. 16. CODE BASED ENTITY FRAMEWORK MIGRATIONS
  17. 17. 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
  18. 18. DATABASE REFRESH EXAMPLE
  19. 19. 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
  20. 20. QUESTIONS?
  21. 21. VIEW SLIDES, BE SOCIAL • Slide link: • Follow-up discussion: Open Spaces • Contact: acordmike@gmail.com • https://www.linkedin.com/in/michaelacord/

×