SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
ROAD TO DATABASE AUTOMATION Eduardo Piairo
Database Source Control
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
• Eduardo Piairo
• @ Celfinet
• DBA
• DevOps
About me
@EdPiairo
https://pt.linkedin.com/in/jesuspiairo
eduardopiairo@outlook.com
http://www.eduardopiairo.com/
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Overview
Source
Control
Continuous
Integration
Continuous
Delivery
How about databases?
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
What’s so special about databases?
Overview
DLM – Database Lifecycle Management
• Data management and data migration
• Data monitoring
• Data recovery
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Motivation
• Database are out of pace with application development
• No traceability of database changes (changes history)
• 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
ROAD TO DATABASE AUTOMATION – 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
ROAD TO DATABASE AUTOMATION – 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
ROAD TO DATABASE AUTOMATION – 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
ROAD TO DATABASE AUTOMATION – 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
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Source control systems
• TFVC (Visual Studio)
• Mercurial (TortoiseHg)
• Git (Source Tree)
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Migrations-based approach vs State-based approach
• Fundamental resource - SQL Script
• State based solutions
• Script represents the current database state
• Migrations based solutions
• Script represents a migration
• Migration represents the next database version
State: Your source of truth is how the database should be
Migrations: Your source of truth is how the database should change
Alex Yates, Pre-sales engineer at Redgate
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Flyway
• Flyway – “Database migrations made easy”
• http://flywaydb.org/
• Open source database migration tool
• My two reasons for adopting Flyway (command-line)
• Simplicity
• Dependencies
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Flyway – Why database migrations?
• The code side
• Version control is now universal with better tools everyday
• We have reproducible builds and continuous integration
• We have well defined release and deployment processes
• The database side
• What state is the database in on this machine?
• Has this script already been applied or not?
• Has the quick fix in production been applied in test afterwards
• How do you set up a new database instance?
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Flyway – Why database migrations?
• Migrations
• Recreate a database from scratch
• Make it clear at all time what state a database is in
• Migrate in a deterministic way from your current version of the database to a newer one
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Flyway – How it works?
• Flyway commands (6)
• migrate
• clean
• info
• validate
• baseline
• repair
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Flyway – How it works?
• Metadata table
• Used to track the state of the database
• Default name: “schema_version”
• If the database is empty, flyway won’t find it and will create it
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Flyway – How it works?
• Metadata table
• Flyway scans the migrations directory (java/sql)
• Migrations are checked against the metadata table
• Migrations are sorted based on their version number and applied in order
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Demo
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Version Control System – The system
• Two components
• Database scripts repository
• Flyway – database migrations
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Version Control System – Scripting rules
• Rule 1: Script version (timestamp)
• Rule 2: Operation type
• Rule 3: Object type
• Rule 4: Object name
• Advice: database objects naming convention
Vyyyymmdd.hhmm__OperationType_ObjectType_ObjectName.sql
• Example
• V20151215.1900__Create_TB_MyTable
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Version Control System – Refactoring databases
• Simple change to a database schema that improves its design while retaining its behavioral and
informational semantics
• Transition Period (Deprecation Period)
• Both schemas (original and new) are supported
• Refactoring categories
• Structural refactoring
• Data quality refactoring
• Architectural refactoring
• Etc.
How good are you doing T-SQL code?
ROAD TO DATABASE AUTOMATION – 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
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Version Control System – Challenges
• Challenge 3 – migration scripts stack
• In other words, is necessary to mange merge/interests conflicts
• 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?
ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL
Q&A
@EdPiairo
https://pt.linkedin.com/in/jesuspiairo
eduardopiairo@outlook.com
http://www.eduardopiairo.com/

Más contenido relacionado

La actualidad más candente

Fine Tuning and Enhancing Performance of Apache Spark Jobs
Fine Tuning and Enhancing Performance of Apache Spark JobsFine Tuning and Enhancing Performance of Apache Spark Jobs
Fine Tuning and Enhancing Performance of Apache Spark JobsDatabricks
 
Elasticsearch for Data Analytics
Elasticsearch for Data AnalyticsElasticsearch for Data Analytics
Elasticsearch for Data AnalyticsFelipe
 
hbaseconasia2019 HBCK2: Concepts, trends, and recipes for fixing issues in HB...
hbaseconasia2019 HBCK2: Concepts, trends, and recipes for fixing issues in HB...hbaseconasia2019 HBCK2: Concepts, trends, and recipes for fixing issues in HB...
hbaseconasia2019 HBCK2: Concepts, trends, and recipes for fixing issues in HB...Michael Stack
 
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみたAlfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみたTasuku Otani
 
Alfresco勉強会#26 Alfresco SDK + Eclipseで開発してみよう
Alfresco勉強会#26 Alfresco SDK + Eclipseで開発してみようAlfresco勉強会#26 Alfresco SDK + Eclipseで開発してみよう
Alfresco勉強会#26 Alfresco SDK + Eclipseで開発してみようJun Terashita
 
Alfresco勉強会#40 QRコードによる文書の振り分け
Alfresco勉強会#40 QRコードによる文書の振り分けAlfresco勉強会#40 QRコードによる文書の振り分け
Alfresco勉強会#40 QRコードによる文書の振り分けTakeshi Totani
 
Share UIカスタマイズ Widget編
Share UIカスタマイズ Widget編Share UIカスタマイズ Widget編
Share UIカスタマイズ Widget編MoritakaSoma
 
Async-await best practices in 10 minutes
Async-await best practices in 10 minutesAsync-await best practices in 10 minutes
Async-await best practices in 10 minutesPaulo Morgado
 
Alfresco勉強会#34 Alfrescoをカスタマイズする時に知っておくと便利なこと
Alfresco勉強会#34 Alfrescoをカスタマイズする時に知っておくと便利なことAlfresco勉強会#34 Alfrescoをカスタマイズする時に知っておくと便利なこと
Alfresco勉強会#34 Alfrescoをカスタマイズする時に知っておくと便利なことJun Terashita
 
Spark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka StreamsSpark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka StreamsGuido Schmutz
 
Deep Dive into the New Features of Apache Spark 3.0
Deep Dive into the New Features of Apache Spark 3.0Deep Dive into the New Features of Apache Spark 3.0
Deep Dive into the New Features of Apache Spark 3.0Databricks
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkRedis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkDatabricks
 
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...Databricks
 
Cloudera Impala Internals
Cloudera Impala InternalsCloudera Impala Internals
Cloudera Impala InternalsDavid Groozman
 
How to Extend Apache Spark with Customized Optimizations
How to Extend Apache Spark with Customized OptimizationsHow to Extend Apache Spark with Customized Optimizations
How to Extend Apache Spark with Customized OptimizationsDatabricks
 

La actualidad más candente (20)

Graylog
GraylogGraylog
Graylog
 
Fine Tuning and Enhancing Performance of Apache Spark Jobs
Fine Tuning and Enhancing Performance of Apache Spark JobsFine Tuning and Enhancing Performance of Apache Spark Jobs
Fine Tuning and Enhancing Performance of Apache Spark Jobs
 
Elasticsearch for Data Analytics
Elasticsearch for Data AnalyticsElasticsearch for Data Analytics
Elasticsearch for Data Analytics
 
hbaseconasia2019 HBCK2: Concepts, trends, and recipes for fixing issues in HB...
hbaseconasia2019 HBCK2: Concepts, trends, and recipes for fixing issues in HB...hbaseconasia2019 HBCK2: Concepts, trends, and recipes for fixing issues in HB...
hbaseconasia2019 HBCK2: Concepts, trends, and recipes for fixing issues in HB...
 
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみたAlfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
 
Alfresco勉強会#26 Alfresco SDK + Eclipseで開発してみよう
Alfresco勉強会#26 Alfresco SDK + Eclipseで開発してみようAlfresco勉強会#26 Alfresco SDK + Eclipseで開発してみよう
Alfresco勉強会#26 Alfresco SDK + Eclipseで開発してみよう
 
Alfresco勉強会#40 QRコードによる文書の振り分け
Alfresco勉強会#40 QRコードによる文書の振り分けAlfresco勉強会#40 QRコードによる文書の振り分け
Alfresco勉強会#40 QRコードによる文書の振り分け
 
Share UIカスタマイズ Widget編
Share UIカスタマイズ Widget編Share UIカスタマイズ Widget編
Share UIカスタマイズ Widget編
 
Async-await best practices in 10 minutes
Async-await best practices in 10 minutesAsync-await best practices in 10 minutes
Async-await best practices in 10 minutes
 
Storage and Alfresco
Storage and AlfrescoStorage and Alfresco
Storage and Alfresco
 
Alfresco勉強会#34 Alfrescoをカスタマイズする時に知っておくと便利なこと
Alfresco勉強会#34 Alfrescoをカスタマイズする時に知っておくと便利なことAlfresco勉強会#34 Alfrescoをカスタマイズする時に知っておくと便利なこと
Alfresco勉強会#34 Alfrescoをカスタマイズする時に知っておくと便利なこと
 
Internal Hive
Internal HiveInternal Hive
Internal Hive
 
Spark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka StreamsSpark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka Streams
 
Deep Dive into the New Features of Apache Spark 3.0
Deep Dive into the New Features of Apache Spark 3.0Deep Dive into the New Features of Apache Spark 3.0
Deep Dive into the New Features of Apache Spark 3.0
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkRedis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
 
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
 
Cloudera Impala Internals
Cloudera Impala InternalsCloudera Impala Internals
Cloudera Impala Internals
 
InfluxDB & Grafana
InfluxDB & GrafanaInfluxDB & Grafana
InfluxDB & Grafana
 
How to Extend Apache Spark with Customized Optimizations
How to Extend Apache Spark with Customized OptimizationsHow to Extend Apache Spark with Customized Optimizations
How to Extend Apache Spark with Customized Optimizations
 
Alfresco tuning part2
Alfresco tuning part2Alfresco tuning part2
Alfresco tuning part2
 

Destacado

Delivering changes for applications and databases
Delivering changes for applications and databasesDelivering changes for applications and databases
Delivering changes for applications and databasesEduardo Piairo
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source controlEduardo Piairo
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs StateEduardo Piairo
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source controlEduardo Piairo
 
Building Rich Domain Models
Building Rich Domain ModelsBuilding Rich Domain Models
Building Rich Domain ModelsChris Richardson
 

Destacado (6)

Delivering changes for applications and databases
Delivering changes for applications and databasesDelivering changes for applications and databases
Delivering changes for applications and databases
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source control
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs State
 
DbOps, DevOps and Ops
DbOps, DevOps and OpsDbOps, DevOps and Ops
DbOps, DevOps and Ops
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source control
 
Building Rich Domain Models
Building Rich Domain ModelsBuilding Rich Domain Models
Building Rich Domain Models
 

Similar a Road to database automation - Database source control

Operations for databases – the agile/devops journey
Operations for databases – the agile/devops journeyOperations for databases – the agile/devops journey
Operations for databases – the agile/devops journeyEduardo Piairo
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs StateEduardo Piairo
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database designSalehein Syed
 
Delivering Changes for Applications and Databases
Delivering Changes for Applications and DatabasesDelivering Changes for Applications and Databases
Delivering Changes for Applications and DatabasesMiguel Alho
 
Operations for databases: the agile/devops journey
Operations for databases: the agile/devops journeyOperations for databases: the agile/devops journey
Operations for databases: the agile/devops journeyEduardo Piairo
 
KoprowskiT_Session2_SDNEvent_SourceControlForDBA
KoprowskiT_Session2_SDNEvent_SourceControlForDBAKoprowskiT_Session2_SDNEvent_SourceControlForDBA
KoprowskiT_Session2_SDNEvent_SourceControlForDBATobias Koprowski
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source controlEduardo Piairo
 
Data Vault Automation at the Bijenkorf
Data Vault Automation at the BijenkorfData Vault Automation at the Bijenkorf
Data Vault Automation at the BijenkorfRob Winters
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the DatabaseMichaela Murray
 
Deployment pipeline for Azure SQL Databases
Deployment pipeline for Azure SQL DatabasesDeployment pipeline for Azure SQL Databases
Deployment pipeline for Azure SQL DatabasesEduardo Piairo
 
Presentation cloud control enterprise manager 12c
Presentation   cloud control enterprise manager 12cPresentation   cloud control enterprise manager 12c
Presentation cloud control enterprise manager 12cxKinAnx
 
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSINGSKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSINGSkillwise Group
 
Deployment pipeline for databases
Deployment pipeline for databasesDeployment pipeline for databases
Deployment pipeline for databasesEduardo Piairo
 
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...garrett honeycutt
 
Grant Fritchey Justin Caldicott - Best practices for database deployments
Grant Fritchey Justin Caldicott - Best practices for database deploymentsGrant Fritchey Justin Caldicott - Best practices for database deployments
Grant Fritchey Justin Caldicott - Best practices for database deploymentsRed Gate Software
 
Remote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts
 
Continuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseContinuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseAidas Dragūnas
 

Similar a Road to database automation - Database source control (20)

Operations for databases – the agile/devops journey
Operations for databases – the agile/devops journeyOperations for databases – the agile/devops journey
Operations for databases – the agile/devops journey
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs State
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database design
 
Delivering Changes for Applications and Databases
Delivering Changes for Applications and DatabasesDelivering Changes for Applications and Databases
Delivering Changes for Applications and Databases
 
Operations for databases: the agile/devops journey
Operations for databases: the agile/devops journeyOperations for databases: the agile/devops journey
Operations for databases: the agile/devops journey
 
Revision
RevisionRevision
Revision
 
KoprowskiT_Session2_SDNEvent_SourceControlForDBA
KoprowskiT_Session2_SDNEvent_SourceControlForDBAKoprowskiT_Session2_SDNEvent_SourceControlForDBA
KoprowskiT_Session2_SDNEvent_SourceControlForDBA
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source control
 
Data Vault Automation at the Bijenkorf
Data Vault Automation at the BijenkorfData Vault Automation at the Bijenkorf
Data Vault Automation at the Bijenkorf
 
Database CI/CD Pipeline
Database CI/CD PipelineDatabase CI/CD Pipeline
Database CI/CD Pipeline
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the Database
 
Deployment pipeline for Azure SQL Databases
Deployment pipeline for Azure SQL DatabasesDeployment pipeline for Azure SQL Databases
Deployment pipeline for Azure SQL Databases
 
Presentation cloud control enterprise manager 12c
Presentation   cloud control enterprise manager 12cPresentation   cloud control enterprise manager 12c
Presentation cloud control enterprise manager 12c
 
Database Testing
Database TestingDatabase Testing
Database Testing
 
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSINGSKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
 
Deployment pipeline for databases
Deployment pipeline for databasesDeployment pipeline for databases
Deployment pipeline for databases
 
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
 
Grant Fritchey Justin Caldicott - Best practices for database deployments
Grant Fritchey Justin Caldicott - Best practices for database deploymentsGrant Fritchey Justin Caldicott - Best practices for database deployments
Grant Fritchey Justin Caldicott - Best practices for database deployments
 
Remote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New Features
 
Continuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseContinuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With Liquibase
 

Más de Eduardo Piairo

ADDO 2021: Why and how to include database changes in the deployment pipeline
ADDO 2021: Why and how to include database changes in the deployment pipelineADDO 2021: Why and how to include database changes in the deployment pipeline
ADDO 2021: Why and how to include database changes in the deployment pipelineEduardo Piairo
 
Adding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipelineAdding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipelineEduardo Piairo
 
Start by changing the way of work
Start by changing the way of workStart by changing the way of work
Start by changing the way of workEduardo Piairo
 
Adding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipelineAdding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipelineEduardo Piairo
 
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineAdding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineEduardo Piairo
 
Adding unit tests with tSQLt 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
Adding unit tests with tSQLt to the database deployment pipelineEduardo Piairo
 
Operations for databases – The DevOps journey
Operations for databases – The DevOps journey Operations for databases – The DevOps journey
Operations for databases – The DevOps journey Eduardo Piairo
 
Deployment pipeline for databases
Deployment pipeline for databasesDeployment pipeline for databases
Deployment pipeline for databasesEduardo Piairo
 
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineAdding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineEduardo Piairo
 
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
Setting a WordPress website using Azure Web Apps And Azure Database for MySQLSetting a WordPress website using Azure Web Apps And Azure Database for MySQL
Setting a WordPress website using Azure Web Apps And Azure Database for MySQLEduardo Piairo
 
Delivering changes for applications and databases @ Azure
Delivering changes for applications and databases @ AzureDelivering changes for applications and databases @ Azure
Delivering changes for applications and databases @ AzureEduardo Piairo
 
Delivering changes for databases and applications
Delivering changes for databases and applicationsDelivering changes for databases and applications
Delivering changes for databases and applicationsEduardo Piairo
 
Workshop: Delivering chnages for applications and databases
Workshop: Delivering chnages for applications and databasesWorkshop: Delivering chnages for applications and databases
Workshop: Delivering chnages for applications and databasesEduardo Piairo
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs StateEduardo Piairo
 
Deployment Pipeline for databases (Azure SQL Database, SQL Server)
Deployment Pipeline for databases (Azure SQL Database, SQL Server)Deployment Pipeline for databases (Azure SQL Database, SQL Server)
Deployment Pipeline for databases (Azure SQL Database, SQL Server)Eduardo Piairo
 

Más de Eduardo Piairo (17)

ADDO 2021: Why and how to include database changes in the deployment pipeline
ADDO 2021: Why and how to include database changes in the deployment pipelineADDO 2021: Why and how to include database changes in the deployment pipeline
ADDO 2021: Why and how to include database changes in the deployment pipeline
 
Adding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipelineAdding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipeline
 
Start by changing the way of work
Start by changing the way of workStart by changing the way of work
Start by changing the way of work
 
Adding unit tests to the database deployment pipeline
Adding unit tests to the database deployment pipelineAdding unit tests to the database deployment pipeline
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 pipelineAdding unit tests with tSQLt 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
 Adding unit tests with tSQLt 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
Operations for databases – The DevOps journey Operations for databases – The DevOps journey
Operations for databases – The DevOps journey
 
Deployment pipeline for databases
Deployment pipeline for databasesDeployment pipeline for databases
Deployment pipeline for databases
 
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipelineAdding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
 
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
Setting a WordPress website using Azure Web Apps And Azure Database for MySQLSetting a WordPress website using Azure Web Apps And Azure Database for MySQL
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
 
SQL Server 2017 CLR
SQL Server 2017 CLRSQL Server 2017 CLR
SQL Server 2017 CLR
 
SQL Server 2017 CLR
SQL Server 2017 CLRSQL Server 2017 CLR
SQL Server 2017 CLR
 
Delivering changes for applications and databases @ Azure
Delivering changes for applications and databases @ AzureDelivering changes for applications and databases @ Azure
Delivering changes for applications and databases @ Azure
 
Delivering changes for databases and applications
Delivering changes for databases and applicationsDelivering changes for databases and applications
Delivering changes for databases and applications
 
Workshop: Delivering chnages for applications and databases
Workshop: Delivering chnages for applications and databasesWorkshop: Delivering chnages for applications and databases
Workshop: Delivering chnages for applications and databases
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs State
 
Deployment Pipeline for databases (Azure SQL Database, SQL Server)
Deployment Pipeline for databases (Azure SQL Database, SQL Server)Deployment Pipeline for databases (Azure SQL Database, SQL Server)
Deployment Pipeline for databases (Azure SQL Database, SQL Server)
 

Último

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSrknatarajan
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 

Último (20)

Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 

Road to database automation - Database source control

  • 1. ROAD TO DATABASE AUTOMATION Eduardo Piairo Database Source Control
  • 2. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL • Eduardo Piairo • @ Celfinet • DBA • DevOps About me @EdPiairo https://pt.linkedin.com/in/jesuspiairo eduardopiairo@outlook.com http://www.eduardopiairo.com/
  • 3. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Overview Source Control Continuous Integration Continuous Delivery How about databases?
  • 4. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL What’s so special about databases? Overview DLM – Database Lifecycle Management • Data management and data migration • Data monitoring • Data recovery
  • 5. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Motivation • Database are out of pace with application development • No traceability of database changes (changes history) • 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
  • 6. ROAD TO DATABASE AUTOMATION – 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
  • 7. ROAD TO DATABASE AUTOMATION – 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
  • 8. ROAD TO DATABASE AUTOMATION – 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
  • 9. ROAD TO DATABASE AUTOMATION – 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
  • 10. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Source control systems • TFVC (Visual Studio) • Mercurial (TortoiseHg) • Git (Source Tree)
  • 11. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Migrations-based approach vs State-based approach • Fundamental resource - SQL Script • State based solutions • Script represents the current database state • Migrations based solutions • Script represents a migration • Migration represents the next database version State: Your source of truth is how the database should be Migrations: Your source of truth is how the database should change Alex Yates, Pre-sales engineer at Redgate
  • 12. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Flyway • Flyway – “Database migrations made easy” • http://flywaydb.org/ • Open source database migration tool • My two reasons for adopting Flyway (command-line) • Simplicity • Dependencies
  • 13. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Flyway – Why database migrations? • The code side • Version control is now universal with better tools everyday • We have reproducible builds and continuous integration • We have well defined release and deployment processes • The database side • What state is the database in on this machine? • Has this script already been applied or not? • Has the quick fix in production been applied in test afterwards • How do you set up a new database instance?
  • 14. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Flyway – Why database migrations? • Migrations • Recreate a database from scratch • Make it clear at all time what state a database is in • Migrate in a deterministic way from your current version of the database to a newer one
  • 15. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Flyway – How it works? • Flyway commands (6) • migrate • clean • info • validate • baseline • repair
  • 16. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Flyway – How it works? • Metadata table • Used to track the state of the database • Default name: “schema_version” • If the database is empty, flyway won’t find it and will create it
  • 17. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Flyway – How it works? • Metadata table • Flyway scans the migrations directory (java/sql) • Migrations are checked against the metadata table • Migrations are sorted based on their version number and applied in order
  • 18. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Demo
  • 19. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Version Control System – The system • Two components • Database scripts repository • Flyway – database migrations
  • 20. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Version Control System – Scripting rules • Rule 1: Script version (timestamp) • Rule 2: Operation type • Rule 3: Object type • Rule 4: Object name • Advice: database objects naming convention Vyyyymmdd.hhmm__OperationType_ObjectType_ObjectName.sql • Example • V20151215.1900__Create_TB_MyTable
  • 21. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Version Control System – Refactoring databases • Simple change to a database schema that improves its design while retaining its behavioral and informational semantics • Transition Period (Deprecation Period) • Both schemas (original and new) are supported • Refactoring categories • Structural refactoring • Data quality refactoring • Architectural refactoring • Etc. How good are you doing T-SQL code?
  • 22. ROAD TO DATABASE AUTOMATION – 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
  • 23. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Version Control System – Challenges • Challenge 3 – migration scripts stack • In other words, is necessary to mange merge/interests conflicts • 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?
  • 24. ROAD TO DATABASE AUTOMATION – DATABASE SOURCE CONTROL Q&A @EdPiairo https://pt.linkedin.com/in/jesuspiairo eduardopiairo@outlook.com http://www.eduardopiairo.com/