SlideShare a Scribd company logo
Road To Database Automation
Database Source Control
Eduardo Piairo
Our Main Sponsors:
Say Thank you to Volunteers:
▪ They spend their FREE time to give you this event.
▪ Because they are crazy. ☺
▪ Because they want YOU
to learn from the BEST IN THE WORLD.
João Sarmento
Eduardo Piairo Diamantino Falcão
Nuno Rafael
Filipe Coelho
Sponsor Sessions at 15:05
▪ Don’t miss them, they might be getting
distributing some awesome prizes!
Auditório Magno
Auditório 1
Exciting certification changes with SQL
Server 2016
Culto de BI
Successful projects
Database Source Control
Eduardo Piairo
DBA & DevOps
About me
@EdPiairo
https://pt.linkedin.com/in/jesuspiairo
eduardopiairo@outlook.com
http://www.eduardopiairo.com/
Database Source Control
Overview
Source
Control
Continuous
Integration
Continuous
Delivery
Database
+
Application
Database Source Control
What’s so special about databases?
Overview
Database Source Control
Motivation
Database are out of pace with application development
Need of synchronization between development and DBA teams
No traceability of database changes (changes history)
What changed? Why? When? Who?
Manual databases processes prevent the CI and CD utilization in their full extent
Database release process is manual
Time consuming and error prone
Releases are less frequent and risky
Database Source Control
Motivation
Tests are manual or do not exists
Bugs in production environment
Database related bugs are only discovered after deployment to production
Fixes and hotfixes have time cost, what can lead to delay a release
Inability to roll back to the previous version of a database
Database setup time of a new environment
Databases become a bottleneck in agile delivery processes
Database Source Control
Why database automation?
Enable control over database development
Keep a versioned “history” of database sates
Increase release frequency though repeatability of processes
Greater predictability over releases
Efficiency by eliminating the repetition of a range of manual activities
Reduce time spent fixing bugs
More control, less exposure to error
Database Source Control
Why database automation?
Faster speed of response to change
Automated deployment of smaller units of change
Remove/reduce human intervention in the release process
The build step is automatic triggered by a “push” into source control repository
The deploy step is automatic triggered by a successfully build process
Greater reliability of the release process
Providing a series of automated test stages prior to deployment
Maintain an agile development environment
Database Source Control
Why database source control?
First step for database automation
Share code (SQL scripts)
Keep history of each change
Your best comunication system
Enforce standards
Database Source Control
Migrations-based approach vs State-based approach
Fundamental resource: SQL Script
Database Source Control
Migrations-based approach vs State-based approach
State based solutions
Script represents the current database state
Your source of truth is how the database should be
Migrations based solutions
Script represents a migration
Migration represents how to transition to the next database version
Your source of truth is how the database should change
Database Source Control
Flyway
Flyway – “Database migrations made easy”
http://flywaydb.org/
Open source database migration tool
Flyway command-line
Simplicity: easy to setup, no need to install
Zero dependencies (java + jdbc)
Scripts are written in SQL
Database Source Control
Demo
Database Source Control
Flyway – How it works?
Flyway commands
migrate, clean info, validate, baseline repair
Metadata table
Used to track the state of the database
If the database is empty, flyway won’t find it and will create it
Flyway scans the migrations directory and check migrations against the metadata table
Migrations are sorted based on their version number and applied in order
Database Source Control
Version Control System – The system
Two components:
Database scripts repository
Flyway – database migrations
Example:
V20161001.1100__Create_TB_MyTable.sql
Rule 1: Script version (timestamp)
Rule 2: Operation type
Rule 3: Object type
Rule 4: Object name
Database Source Control
Demo
Database Source Control
Version Control System – Challenges
Challenge 1 – manage multiple branches
In other words, is necessary to mange merge/interests conflicts
The default branch is the main/master branch and all the merges for this branch must be
done with caution
Challenge 2 – script expiration date
Should the migration script have expiration date?
Sometimes, in the next day the migration script makes no sense anymore
Database Source Control
Version Control System – Challenges
Challenge 3 – migration scripts stack
How can I manage the dependencies between different databases?
And how about dependencies between applications/components
Challenge 4 – developer sandbox
How to supply a disposable development environment where the database is
included?
Database Source Control
What’s next?
Database Source Control
Q&A
@EdPiairo
https://pt.linkedin.com/in/jesuspiairo
eduardopiairo@outlook.com
http://www.eduardopiairo.com/

More Related Content

PDF
Delivering changes for databases and applications
PDF
The future of DevOps: fully left-shifted deployments with version control and...
PPTX
Why retail companies can't afford database downtime
PPTX
Redgate database DevOps demo webinar (with Git & Jenkins)
PPT
Symantec I3 - Inquire & Cluster
PDF
Delivering Changes for Applications and Databases
PDF
Delivering changes for applications and databases
PDF
Road to database automation: database source control
Delivering changes for databases and applications
The future of DevOps: fully left-shifted deployments with version control and...
Why retail companies can't afford database downtime
Redgate database DevOps demo webinar (with Git & Jenkins)
Symantec I3 - Inquire & Cluster
Delivering Changes for Applications and Databases
Delivering changes for applications and databases
Road to database automation: database source control

Similar to Road to database automation: database source control (20)

PDF
Workshop: Delivering chnages for applications and databases
PPTX
Database CI/CD Pipeline
PDF
Road to database automation: database source control
PPTX
The Science of database CICD - UKOUG Breakthrough
PDF
Delivering changes for applications and databases @ Azure
PDF
Relational Database CI/CD
PDF
Road to database automation - Database source control
PPTX
Team Foundation Server 2010 - Overview
PPTX
Practical Guidance for SharePoint 2010 Upgrade
PPT
Alm Specialist Toolkit Team System 2008 Deep Dive
PPTX
Building an automated database deployment pipeline
PPTX
Webinar - Devops platform for the evolving enterprise
PPTX
Software Project Management - NESDEV
PPTX
Whats New In 2010 (Msdn & Visual Studio)
PDF
Automation and Release in Federal
PPTX
Delphix and DBmaestro
PPTX
Database Deployment Pipeline - SQL In The City Workshop 2014
PPTX
Building Real World Applications using Windows Azure - Scott Guthrie, 2nd Dec...
PPTX
Building azure applications ireland
PPTX
#DOAW16 - DevOps@work Roma 2016 - Databases under source control
Workshop: Delivering chnages for applications and databases
Database CI/CD Pipeline
Road to database automation: database source control
The Science of database CICD - UKOUG Breakthrough
Delivering changes for applications and databases @ Azure
Relational Database CI/CD
Road to database automation - Database source control
Team Foundation Server 2010 - Overview
Practical Guidance for SharePoint 2010 Upgrade
Alm Specialist Toolkit Team System 2008 Deep Dive
Building an automated database deployment pipeline
Webinar - Devops platform for the evolving enterprise
Software Project Management - NESDEV
Whats New In 2010 (Msdn & Visual Studio)
Automation and Release in Federal
Delphix and DBmaestro
Database Deployment Pipeline - SQL In The City Workshop 2014
Building Real World Applications using Windows Azure - Scott Guthrie, 2nd Dec...
Building azure applications ireland
#DOAW16 - DevOps@work Roma 2016 - Databases under source control
Ad

More from Eduardo Piairo (20)

PDF
ADDO 2021: Why and how to include database changes in the deployment pipeline
PDF
Adding unit tests to the database deployment pipeline
PDF
Start by changing the way of work
PDF
Adding unit tests to the database deployment pipeline
PDF
Adding unit tests with tSQLt to the database deployment pipeline
PDF
Adding unit tests with tSQLt to the database deployment pipeline
PDF
Operations for databases – The DevOps journey
PDF
Deployment pipeline for databases
PDF
Deployment pipeline for databases
PDF
Adding unit tests with tSQLt to the database deployment pipeline
PDF
Operations for databases: the agile/devops journey
PDF
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
PDF
SQL Server 2017 CLR
PDF
SQL Server 2017 CLR
PDF
Deployment pipeline for Azure SQL Databases
PDF
Operations for databases – the agile/devops journey
PDF
Database Source Control: Migrations vs State
PDF
Deployment Pipeline for databases (Azure SQL Database, SQL Server)
PPTX
Database Source Control: Migrations vs State
PDF
DbOps, DevOps and Ops
ADDO 2021: Why and how to include database changes in the deployment pipeline
Adding unit tests to the database deployment pipeline
Start by changing the way of work
Adding unit tests to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
Operations for databases – The DevOps journey
Deployment pipeline for databases
Deployment pipeline for databases
Adding unit tests with tSQLt to the database deployment pipeline
Operations for databases: the agile/devops journey
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
SQL Server 2017 CLR
SQL Server 2017 CLR
Deployment pipeline for Azure SQL Databases
Operations for databases – the agile/devops journey
Database Source Control: Migrations vs State
Deployment Pipeline for databases (Azure SQL Database, SQL Server)
Database Source Control: Migrations vs State
DbOps, DevOps and Ops
Ad

Recently uploaded (20)

PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Introduction to Artificial Intelligence
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
System and Network Administration Chapter 2
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
assetexplorer- product-overview - presentation
PPTX
L1 - Introduction to python Backend.pptx
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Digital Systems & Binary Numbers (comprehensive )
How to Choose the Right IT Partner for Your Business in Malaysia
Introduction to Artificial Intelligence
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Which alternative to Crystal Reports is best for small or large businesses.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
System and Network Administration Chapter 2
Odoo Companies in India – Driving Business Transformation.pdf
assetexplorer- product-overview - presentation
L1 - Introduction to python Backend.pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
Wondershare Filmora 15 Crack With Activation Key [2025
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms II-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Softaken Excel to vCard Converter Software.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
wealthsignaloriginal-com-DS-text-... (1).pdf

Road to database automation: database source control

  • 1. Road To Database Automation Database Source Control Eduardo Piairo
  • 3. Say Thank you to Volunteers: ▪ They spend their FREE time to give you this event. ▪ Because they are crazy. ☺ ▪ Because they want YOU to learn from the BEST IN THE WORLD. João Sarmento Eduardo Piairo Diamantino Falcão Nuno Rafael Filipe Coelho
  • 4. Sponsor Sessions at 15:05 ▪ Don’t miss them, they might be getting distributing some awesome prizes! Auditório Magno Auditório 1 Exciting certification changes with SQL Server 2016 Culto de BI Successful projects
  • 5. Database Source Control Eduardo Piairo DBA & DevOps About me @EdPiairo https://pt.linkedin.com/in/jesuspiairo eduardopiairo@outlook.com http://www.eduardopiairo.com/
  • 7. Database Source Control What’s so special about databases? Overview
  • 8. Database Source Control Motivation Database are out of pace with application development Need of synchronization between development and DBA teams No traceability of database changes (changes history) What changed? Why? When? Who? Manual databases processes prevent the CI and CD utilization in their full extent Database release process is manual Time consuming and error prone Releases are less frequent and risky
  • 9. Database Source Control Motivation Tests are manual or do not exists Bugs in production environment Database related bugs are only discovered after deployment to production Fixes and hotfixes have time cost, what can lead to delay a release Inability to roll back to the previous version of a database Database setup time of a new environment Databases become a bottleneck in agile delivery processes
  • 10. Database Source Control Why database automation? Enable control over database development Keep a versioned “history” of database sates Increase release frequency though repeatability of processes Greater predictability over releases Efficiency by eliminating the repetition of a range of manual activities Reduce time spent fixing bugs More control, less exposure to error
  • 11. Database Source Control Why database automation? Faster speed of response to change Automated deployment of smaller units of change Remove/reduce human intervention in the release process The build step is automatic triggered by a “push” into source control repository The deploy step is automatic triggered by a successfully build process Greater reliability of the release process Providing a series of automated test stages prior to deployment Maintain an agile development environment
  • 12. Database Source Control Why database source control? First step for database automation Share code (SQL scripts) Keep history of each change Your best comunication system Enforce standards
  • 13. Database Source Control Migrations-based approach vs State-based approach Fundamental resource: SQL Script
  • 14. Database Source Control Migrations-based approach vs State-based approach State based solutions Script represents the current database state Your source of truth is how the database should be Migrations based solutions Script represents a migration Migration represents how to transition to the next database version Your source of truth is how the database should change
  • 15. Database Source Control Flyway Flyway – “Database migrations made easy” http://flywaydb.org/ Open source database migration tool Flyway command-line Simplicity: easy to setup, no need to install Zero dependencies (java + jdbc) Scripts are written in SQL
  • 17. Database Source Control Flyway – How it works? Flyway commands migrate, clean info, validate, baseline repair Metadata table Used to track the state of the database If the database is empty, flyway won’t find it and will create it Flyway scans the migrations directory and check migrations against the metadata table Migrations are sorted based on their version number and applied in order
  • 18. Database Source Control Version Control System – The system Two components: Database scripts repository Flyway – database migrations Example: V20161001.1100__Create_TB_MyTable.sql Rule 1: Script version (timestamp) Rule 2: Operation type Rule 3: Object type Rule 4: Object name
  • 20. Database Source Control Version Control System – Challenges Challenge 1 – manage multiple branches In other words, is necessary to mange merge/interests conflicts The default branch is the main/master branch and all the merges for this branch must be done with caution Challenge 2 – script expiration date Should the migration script have expiration date? Sometimes, in the next day the migration script makes no sense anymore
  • 21. Database Source Control Version Control System – Challenges Challenge 3 – migration scripts stack How can I manage the dependencies between different databases? And how about dependencies between applications/components Challenge 4 – developer sandbox How to supply a disposable development environment where the database is included?