SlideShare a Scribd company logo
Migrationа and source
control for your DB
what:
Database migration:
Database structure:
- Tables, constrains, indexes;
Database data:
- Initial data like list of post codes,
statuses for order, etc.
Database logic:
- stored procedures, triggers, functions
why: versions
Data Base migration:
Data base structure:
- Tables, constrains, indexes;
Data base data:
- Initial data like list of post codes,
statuses for order, etc.
Data base logic:
- stored procedures, triggers, functions
v1.0.0
why: versions
Data Base migration:
Data base structure:
- Tables, constrains, indexes;
Data base data:
v1.0.0
why: versions
Data Base migration:
Data base structure:
- Tables, constrains, indexes;
Data base data:
- Initial data like list of post co
v1.2.1
v1.0.0
Data Base migration:
Data base structure:
- Tables, constrains, indexes;
Data base data:
- Initial data like list of post
v1.2.1
v1.6.0
v1.0.0
why: versions
Data Base migration:
Data base structure:
- Tables, constrains, indexes;
Data base data:
- Initial data like list of post c
v1.2.1
v1.6.0
v2.0.1
v1.0.0
why: versions
Data Base migration:
Data base structure:
- Tables, constrains, indexes;
Data base data:
- Initial data like list of post codes,
statuses for order, etc.
Data base logic:
- stored procedures, triggers, functions
v1.2.1
v1.6.0
v2.0.1
v1.0.0
why: versions
Data Base migration:
Data base structure:
- Tables, constrains, indexes;
Data base data:
- Initial data like list of post codes,
statuses for order, etc.
Data base logic:
- stored procedures, triggers, functions
v1.2.1
v1.6.0
v2.0.1
v1.0.0DEV
why: environments
Conclusion
We need version control
over our database
migration
Tools
Play framework:migration
Rails ActiveRecord
migrations
Mogeez for
Tools
Play framework:migration
Rails ActiveRecord
migrations
Mongeez for
Tools
Play framework:migration
Rails ActiveRecord
migrations
Mogeez for
Tools
Play framework:migration
Rails ActiveRecord
migrations
Mogeez for
Tools
Liquibase :
•Apache license
•Started in 2006 (active)
•http://liquibase.org
Flyway:
•Apache license
•Started in 2010
•http://www.flywaydb.or
g
Common flow
Build Test Run
• Dev
• Test
• Acceptance
• Production
• GUI tests
• Integration
tests
• API tests
• Unit tests
• Ant
• Maven
• Gradle
Common flow
Build Test Run
• Dev
• Test
• Acceptance
• Production
• GUI tests
• Integration
tests
• API tests
• Unit tests
• Ant
• Maven
• Gradle
Common flow
Build Test Run
• Java API
• Spring Bean
• Plugins
• CLI
• Plugins
• CLI
How it works
DatabaseChangelogLock:
DatabaseChangelog:
How it works
Schema_versions:
How it works
Sequential change flow
1. Init db
2. Add column “type”
3. Add new table
How it works
Sequential change flow
1. Init db
2. Add column “type”
3. Add new table
X
How it works
Sequential change flow
1. Init db
3. Add new table
4. Remove column “type”
2. Add column “type”
difference?, comparison.
Rollback vs no rollback
SQL output
Conditions
baseline
Supported modes:
https://flywaydb.org/documentation/gradle/
Flyway more and esear.
How it works
V1__Initial_Setup.sql
V1_1__First_Changes.sql
V1_2__Added_user_info.sql
V2__ ….
How it works
Changes are grouped into changesets:
• Change(s) that should be applied
atomically
Changesets are grouped into
changelogs:
•Files managed in version control
How it works
v1_changeLog.xml
v1.1_changeLog.xml
v2_changeLog.xml
v1.2_changeLog.xml
v1.3_changeLog.xml
v2.1_changeLog.xml
…
Supported db list
MySQL
PostgreSQL
Oracle
MSSQL Server
Sybase_Enterprise
Sybase_Anywhere
DB2
Apache_Derby
HSQL
H2
Informix
Firebird
SQLite
MySQL
PostgreSQL
Oracle
MSSQL Server
SQL Azure
MariaDB
Phoenix
Vertica
AWS Redshift
DB2, DB2 z/OS
Derby
H2, Hsql, SQLite, SAP HANA,
solidDB, Sybase ASE
Supported formats
DSL for database
changes:
• XML
• YAML
• JSON
• sql
Pure SQL
Base line
Convention over
configuration
Toolbox
Toolbox
• SQL output
• Rollback
• Context
• Precondition
Toolbox: precondition
<preConditions onFail="WARN" onError="MARK_RAN">
<dbms type="oracle"/>
<runningAs username="SYSTEM"/>
<tableExists tableName=“newTable"/>
<customPrecondition className=“com.example.CheckOne"/>
<sqlCheck expectedResult="0">
select count(*) from oldtable
</sqlCheck>
</preConditions>
Toolbox: precondition
<preConditions onFail="WARN" onError="MARK_RAN">
<dbms type="oracle"/>
<runningAs username="SYSTEM"/>
<tableExists tableName=“newTable"/>
<customPrecondition className=“com.example.CheckOne"/>
<sqlCheck expectedResult="0">
select count(*) from oldtable
</sqlCheck>
</preConditions>
Toolbox: precondition
<preConditions onFail="WARN" onError="MARK_RAN">
<dbms type="oracle"/>
<runningAs username="SYSTEM"/>
<tableExists tableName=“newTable"/>
<customPrecondition className=“com.example.CheckOne"/>
<sqlCheck expectedResult="0">
select count(*) from oldtable
</sqlCheck>
</preConditions>
Toolbox: precondition
<preConditions onFail="WARN" onError="MARK_RAN">
<dbms type="oracle"/>
<runningAs username="SYSTEM"/>
<tableExists tableName=“newTable"/>
<customPrecondition className=“com.example.CheckOne"/>
<sqlCheck expectedResult="0">
select count(*) from oldtable
</sqlCheck>
</preConditions>
Toolbox: precondition
<preConditions onFail="WARN" onError="MARK_RAN">
<dbms type="oracle"/>
<runningAs username="SYSTEM"/>
<tableExists tableName=“newTable"/>
<customPrecondition className=“com.example.CheckOne"/>
<sqlCheck expectedResult="0">
select count(*) from oldtable
</sqlCheck>
</preConditions>
Toolbox: precondition
<preConditions onFail="WARN" onError="MARK_RAN">
<dbms type="oracle"/>
<runningAs username="SYSTEM"/>
<tableExists tableName=“newTable"/>
<customPrecondition className=“com.example.CheckOne"/>
<sqlCheck expectedResult="0">
select count(*) from oldtable
</sqlCheck>
</preConditions>
Toolbox: precondition
<preConditions onFail="WARN" onError="MARK_RAN">
<dbms type="oracle"/>
<runningAs username="SYSTEM"/>
<tableExists tableName=“newTable"/>
<customPrecondition className=“com.example.CheckOne"/>
<sqlCheck expectedResult="0">
select count(*) from oldtable
</sqlCheck>
</preConditions>
DEMO
let us try it
DDLv1
DDL
v2
v1
Init data,
new column
(source)
let us try it
how it works
DDL
v2
v3
v1
Init data,
new column
(source)
Move values in
separate table
let us try it
let us try it
DDL
v2
v3
v1
Init data,
new column
(source)
Move values in
separate table
Thank you for attention
Q & A
uholnikovroman@gmail.com

More Related Content

PDF
Valerii Moisieienko Apache hbase workshop
PPT
Ms sql server architecture
PPTX
Sql server 2012 dba online training
PDF
Rails DB migrations
PDF
How to Fine-Tune Performance Using Amazon Redshift
PPT
8. column oriented databases
PPTX
Sql server basics
PDF
NoSQL databases
Valerii Moisieienko Apache hbase workshop
Ms sql server architecture
Sql server 2012 dba online training
Rails DB migrations
How to Fine-Tune Performance Using Amazon Redshift
8. column oriented databases
Sql server basics
NoSQL databases

What's hot (18)

PPTX
Introducing ms sql_server_updated
PDF
HBaseCon 2015- HBase @ Flipboard
PDF
SQL Server 2012 - FileTables
PPTX
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
PPTX
Apache storm
PPTX
End-to-end Data Governance with Apache Avro and Atlas
PPT
Sql server basics
PDF
MS-SQL SERVER ARCHITECTURE
PDF
Apache HBase 0.98
PPTX
Apache Spark Streaming
PDF
HBaseCon 2012 | HBase Schema Design - Ian Varley, Salesforce
PPTX
AWS (Amazon Redshift) presentation
PDF
Microsoft SQL Server - Files and Filegroups
PPTX
Inside SQL Server In-Memory OLTP
PPTX
SQL Server 2016 New Features and Enhancements
PPT
Hbase an introduction
PDF
HBase and Impala Notes - Munich HUG - 20131017
Introducing ms sql_server_updated
HBaseCon 2015- HBase @ Flipboard
SQL Server 2012 - FileTables
Real Time Operational Analytics with Microsoft Sql Server 2016 [Liviu Ieran]
Apache storm
End-to-end Data Governance with Apache Avro and Atlas
Sql server basics
MS-SQL SERVER ARCHITECTURE
Apache HBase 0.98
Apache Spark Streaming
HBaseCon 2012 | HBase Schema Design - Ian Varley, Salesforce
AWS (Amazon Redshift) presentation
Microsoft SQL Server - Files and Filegroups
Inside SQL Server In-Memory OLTP
SQL Server 2016 New Features and Enhancements
Hbase an introduction
HBase and Impala Notes - Munich HUG - 20131017
Ad

Viewers also liked (14)

PPT
Accessmodifier
PDF
SE2016 Exotic Elena Morgun "GIL in different programming languages"
PPTX
Herramientas web2.0
PDF
SE2016 BigData Volodymyr Getmanskyi "How to build a dynamic pricing model usi...
PDF
Newsletter May 2016
PPTX
Swiss gold
PDF
SE2016 BigData Den Golotyuk "Big Data from 30 million daily users"
ODP
οι πρώτοι χριστιανοί
PPT
Eθνικη Bιβλιοθηκη
PDF
Arellano Bernardo III Geog 292 Ang Pagpangayaw sa Dutang Ginsaad
PPT
Javafeature
PPT
Accessmodifier
SE2016 Exotic Elena Morgun "GIL in different programming languages"
Herramientas web2.0
SE2016 BigData Volodymyr Getmanskyi "How to build a dynamic pricing model usi...
Newsletter May 2016
Swiss gold
SE2016 BigData Den Golotyuk "Big Data from 30 million daily users"
οι πρώτοι χριστιανοί
Eθνικη Bιβλιοθηκη
Arellano Bernardo III Geog 292 Ang Pagpangayaw sa Dutang Ginsaad
Javafeature
Ad

Similar to SE2016 Java Roman Ugolnikov "Migration and source control for your DB" (20)

PPTX
Liquibase
PPTX
Liquibase migration for data bases
PDF
Delivering changes for applications and databases
PDF
Delivering Changes for Applications and Databases
PDF
Practical Ruby Projects with MongoDB - Ruby Kaigi 2010
PPTX
FluentMigrator - Dayton .NET - July 2023
PPTX
Evolutionary database design
PPTX
Webinar: Migrating from RDBMS to MongoDB (June 2015)
PDF
Introduction to sq lite
PPTX
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
PPTX
Flyway
PDF
Flyway _ A Database Version Management Tool
PDF
Gaelyk - Web Apps In Practically No Time
PPTX
Flyway: The agile database migration framework for Java
KEY
Appengine Nljug
PDF
Migrating from RDBMS to MongoDB
PPTX
Introduction to Database System Concepts and ArchitectureDBMS_I_UNIT.pptx
PDF
Are we there Yet?? (The long journey of Migrating from close source to opens...
PPTX
Database Basics
Liquibase
Liquibase migration for data bases
Delivering changes for applications and databases
Delivering Changes for Applications and Databases
Practical Ruby Projects with MongoDB - Ruby Kaigi 2010
FluentMigrator - Dayton .NET - July 2023
Evolutionary database design
Webinar: Migrating from RDBMS to MongoDB (June 2015)
Introduction to sq lite
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
Flyway
Flyway _ A Database Version Management Tool
Gaelyk - Web Apps In Practically No Time
Flyway: The agile database migration framework for Java
Appengine Nljug
Migrating from RDBMS to MongoDB
Introduction to Database System Concepts and ArchitectureDBMS_I_UNIT.pptx
Are we there Yet?? (The long journey of Migrating from close source to opens...
Database Basics

More from Inhacking (20)

PDF
SE2016 Fundraising Roman Kravchenko "Investment in Ukrainian IoT-Startups"
PDF
SE2016 Fundraising Wlodek Laskowski "Insider guide to successful fundraising ...
PDF
SE2016 Fundraising Andrey Sobol "Blockchain Crowdfunding or "Mommy, look, I l...
PDF
SE2016 Company Development Valentin Dombrovsky "Travel startups challenges an...
PDF
SE2016 Company Development Vadym Gorenko "How to pass the death valley"
PDF
SE2016 Marketing&PR Jan Keil "Do the right thing marketing for startups"
PDF
SE2016 PR&Marketing Mikhail Patalakha "ASO how to start and how to finish"
PDF
SE2016 UI/UX Alina Kononenko "Designing for Apple Watch and Apple TV"
PDF
SE2016 Management Mikhail Lebedinkiy "iAIST the first pure ukrainian corporat...
PDF
SE2016 Management Anna Lavrova "Gladiator in the suit crisis is our brand!"
PDF
SE2016 Management Aleksey Solntsev "Management of the projects in the conditi...
PDF
SE2016 Management Vitalii Laptenok "Processes and planning for a product comp...
PDF
SE2016 Management Yana Prolis "Please don't burn down!"
PDF
SE2016 Management Marina Bril "Management at marketing teams and performance"
PDF
SE2016 iOS Anton Fedorchenko "Swift for Server-side Development"
PDF
SE2016 iOS Alexander Voronov "Test driven development in real world"
PDF
SE2016 JS Gregory Shehet "Undefined on prod, or how to test a react application"
PDF
SE2016 JS Alexey Osipenko "Basics of functional reactive programming"
PDF
SE2016 Java Vladimir Mikhel "Scrapping the web"
PDF
SE2016 Java Valerii Moisieienko "Apache HBase Workshop"
SE2016 Fundraising Roman Kravchenko "Investment in Ukrainian IoT-Startups"
SE2016 Fundraising Wlodek Laskowski "Insider guide to successful fundraising ...
SE2016 Fundraising Andrey Sobol "Blockchain Crowdfunding or "Mommy, look, I l...
SE2016 Company Development Valentin Dombrovsky "Travel startups challenges an...
SE2016 Company Development Vadym Gorenko "How to pass the death valley"
SE2016 Marketing&PR Jan Keil "Do the right thing marketing for startups"
SE2016 PR&Marketing Mikhail Patalakha "ASO how to start and how to finish"
SE2016 UI/UX Alina Kononenko "Designing for Apple Watch and Apple TV"
SE2016 Management Mikhail Lebedinkiy "iAIST the first pure ukrainian corporat...
SE2016 Management Anna Lavrova "Gladiator in the suit crisis is our brand!"
SE2016 Management Aleksey Solntsev "Management of the projects in the conditi...
SE2016 Management Vitalii Laptenok "Processes and planning for a product comp...
SE2016 Management Yana Prolis "Please don't burn down!"
SE2016 Management Marina Bril "Management at marketing teams and performance"
SE2016 iOS Anton Fedorchenko "Swift for Server-side Development"
SE2016 iOS Alexander Voronov "Test driven development in real world"
SE2016 JS Gregory Shehet "Undefined on prod, or how to test a react application"
SE2016 JS Alexey Osipenko "Basics of functional reactive programming"
SE2016 Java Vladimir Mikhel "Scrapping the web"
SE2016 Java Valerii Moisieienko "Apache HBase Workshop"

Recently uploaded (20)

PDF
Understanding Forklifts - TECH EHS Solution
PDF
Digital Strategies for Manufacturing Companies
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Introduction to Artificial Intelligence
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
medical staffing services at VALiNTRY
PDF
Nekopoi APK 2025 free lastest update
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Transform Your Business with a Software ERP System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Understanding Forklifts - TECH EHS Solution
Digital Strategies for Manufacturing Companies
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
PTS Company Brochure 2025 (1).pdf.......
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Computer Software and OS of computer science of grade 11.pptx
CHAPTER 2 - PM Management and IT Context
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Introduction to Artificial Intelligence
Upgrade and Innovation Strategies for SAP ERP Customers
Which alternative to Crystal Reports is best for small or large businesses.pdf
medical staffing services at VALiNTRY
Nekopoi APK 2025 free lastest update
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Transform Your Business with a Software ERP System
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf

SE2016 Java Roman Ugolnikov "Migration and source control for your DB"