SlideShare a Scribd company logo
1 of 55
Download to read offline
Database migrations

the missing piece in Java EE

BOF3528
Rikard Thulin
This is a short version of this talk
!
Full length video available at:
http://vimeo.com/105880153
Rikard Thulin
We will discuss how

schema migrations
improves the software engineering life cycle and the
possibilities to improve Java for the future
Roadmap
• Introduction to the topic and why it is so important (7 min)
• Schema Migrations demo (8 min)
• The current situation, the tools of the trade (5 min)
• Future possibilities at hand to solve this problem (5 min)
• Discussion (15 min)
About me
Part 1
!
Introduction to the topic 

and why it is so important
Staging clusterCI
How do we keep 

everything CONSISTENT?
QA
Staging cluster
Prod clusterProd cluster
Dev team
{code}
VCS Build server
How do we keep 

{ code }
CONSISTENT?
artifacts
Repository
push pull
publish
release
QA
promote
DEV/CIStaging
Prod
Dev team
What is the 

problem?
Two entities
Really?
Is the database EVIL?
artifact manual, script, …
Source Database
HOW
artifact manual, script, …
Source Database
db deltas,

automatic
artifact
Source


{code +
migrations}
VCS Build server
How do we keep 

{ code + database }
CONSISTENT?


artifacts
{code +
migrations}
Repository
push pull
publish
release
QA
promote
Staging
Prod
Dev team
DEV/CI
Shiny Happy People
We get
Schema Migration
DEMO DEMO DEMO DEMO
Schema Migration
DEMO DEMO DEMO DEMO
Migrations are applied automatically 

during deployment
Schema Migration
DEMO DEMO DEMO DEMO
Spring based application
Shiny Happy People
DEMONSTRATION OF
LOCAL DEV PROD
Version 0 Version 0 Version 0
LOCAL DEV PROD
Version 1 Version 0 Version 0
LOCAL DEV PROD
Version 1 Version 1 Version 0
LOCAL DEV PROD
Version 2 Version 1 Version 0
LOCAL DEV PROD
Version 2 Version 3 Version 0
LOCAL DEV PROD
Version 2 Version 3 Version 3
What can we do?
create/drop TABLE

create/drop INDEX

add/remove CONSTRAINT
java REFACTORINGS
STORED PROCEDURES

create/drop VIEWS
insert DATA
!
and more!
What 

is the trick?
When 

is the trick?
Another view
Automatization of:

a sequences of instructions to be executed
given the revision of the source code
Database Change Management

Real Life Tricks
• Possible to use on an existing database
• Quick and simple to implement
• Database copies mix and match
• Wash copies of production database
• DBA approval / review process
• One click release possible
Part 2
!
The current situation 

tools of the trade
Tools of the Trade
ActiveRecord Ruby (Ruby)
Entity Framework Migrations (.net)
COMPETITION 

HAS IT
Tools of the Trade
Hibernate & JPA

Schema Generation
Tools of the Trade
FlyWay & Liquibase
Stronger execution order
Supports different DB / environment
Stereotype of being “heavyweight"
Automatic rollback
Convention over configuration

Gaining popularity
Tools of the Trade
FlyWay
Convention over configuration

Get up and running in 5 minutes

Gaining popularity
Tools of the Trade
Liquibase
Stronger execution order
Supports different DB for different environment
Stereotype of being “heavyweight"
Automatic rollback
Tools of the Trade
I [Nathan Voxland] would summarize the differences as:
!
FlyWay is "lower level" with you specifying exactly the SQL
you want ran whereas Liquibase is "higher level" with you
specifying what you want changed and Liquibase
computing the SQL
!
FlyWay manages changes by filename whereas Liquibase
manages changes by order in a file.


Nathan Voxland, Liquibase developer
Tools of the Trade
summary
Schema migration is
•Not solved by Java EE today
•Solved by 3PP
•Already in competitors standards
Part 3
!
Future possibilities 

to solve this problem
The future
my proposal
Add schema migration to
Java EE
Reasons to add Migrations to Java EE
We are behind the competition
Schema migrations is not well know
to the broad developer community
Increased Quality and Productivity

Adding complexity to the platform
Advanced tooling
the future?
the future?
class User {
}
@Migration(id="1", author="duke")
class CreateUserTable {
!
@CreateTable(User.class)
@AddColumn(User.class)
long id;
!
@AddColumn(entity = User.class, size = "255")
String name;
}
the future?
Warning: the following slides are possibilities for the future — not what we have
the future?
@Migration(id="1",
author="duke")
class CreateUserTable {
@AddColumn(User.class)
long id;
…
}
@Entity
class User {
@Id
long id;
…
}
Migration2Code
Generator
Warning: the following slides are possibilities for the future — not what we have
@Entity
class User {
!
@Id
long id;
!
@Column(size="255")
String name;
}
the future?
@Migration(id="2", author="duke")
class AddColumnsToUser {
!
@DropColumn(User.class)
String name;
!
@AddColumn(entity = User.class, size="80")
String firstName;
!
@AddColumn(entity = User.class, size="80")
String lastName;
!
@AddColumn(entity = User.class, size="255")
String email;
}
the future?
Warning: the following slides are possibilities for the future — not what we have
@Entity
class User {
!
@Id
long id;
!
@Column(size="80")
String firstName;
!
@Column(size="80")
String lastName;
!
@Column(size="255")
String email;
}
the future?
Wrap up
YOU! Should use Schema Migration

WE? JCP JSR! "
What? Lets figure it out!"
When? Now. Lets start!
rikard.thulin@squeed.com
Discussion 

and

Q & A
rikard.thulin@squeed.com

More Related Content

What's hot

Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019graemerocher
 
JavaFX and HTML5 - Like Curds and Rice
JavaFX and HTML5 - Like Curds and RiceJavaFX and HTML5 - Like Curds and Rice
JavaFX and HTML5 - Like Curds and RiceStephen Chin
 
Moving To The Client - JavaFX and HTML5
Moving To The Client - JavaFX and HTML5Moving To The Client - JavaFX and HTML5
Moving To The Client - JavaFX and HTML5Stephen Chin
 
Database deployment: still hard after all these years - Data Saturday #1
Database deployment: still hard after all these years - Data Saturday #1Database deployment: still hard after all these years - Data Saturday #1
Database deployment: still hard after all these years - Data Saturday #1Giulio Vian
 
Building RIA Applications with JavaFX
Building RIA Applications with JavaFXBuilding RIA Applications with JavaFX
Building RIA Applications with JavaFXMax Katz
 
Jasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScriptJasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScriptSumanth krishna
 
Micronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless EraMicronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless Eragraemerocher
 
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)Stephen Chin
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Stephen Chin
 
OSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and AndroidOSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and Androidmfrancis
 
A SOA approximation on symfony
A SOA approximation on symfonyA SOA approximation on symfony
A SOA approximation on symfonyJoseluis Laso
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Mihail Stoynov
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applicationsJulien Dubois
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Kile Niklawski
 

What's hot (20)

Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
 
Javantura v4 - Angular2 - Ionic2 - from birth to stable versions - Hrvoje Pek...
Javantura v4 - Angular2 - Ionic2 - from birth to stable versions - Hrvoje Pek...Javantura v4 - Angular2 - Ionic2 - from birth to stable versions - Hrvoje Pek...
Javantura v4 - Angular2 - Ionic2 - from birth to stable versions - Hrvoje Pek...
 
JavaFX and HTML5 - Like Curds and Rice
JavaFX and HTML5 - Like Curds and RiceJavaFX and HTML5 - Like Curds and Rice
JavaFX and HTML5 - Like Curds and Rice
 
Moving To The Client - JavaFX and HTML5
Moving To The Client - JavaFX and HTML5Moving To The Client - JavaFX and HTML5
Moving To The Client - JavaFX and HTML5
 
Database deployment: still hard after all these years - Data Saturday #1
Database deployment: still hard after all these years - Data Saturday #1Database deployment: still hard after all these years - Data Saturday #1
Database deployment: still hard after all these years - Data Saturday #1
 
Building RIA Applications with JavaFX
Building RIA Applications with JavaFXBuilding RIA Applications with JavaFX
Building RIA Applications with JavaFX
 
Jasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScriptJasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScript
 
Micronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless EraMicronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless Era
 
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
Javantura v4 - FreeMarker in Spring web - Marin KalapaćJavantura v4 - FreeMarker in Spring web - Marin Kalapać
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
 
Java 9 Modularity in Action
Java 9 Modularity in ActionJava 9 Modularity in Action
Java 9 Modularity in Action
 
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
 
OSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and AndroidOSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and Android
 
A SOA approximation on symfony
A SOA approximation on symfonyA SOA approximation on symfony
A SOA approximation on symfony
 
Javantura v4 - Java and lambdas and streams - are they better than for loops ...
Javantura v4 - Java and lambdas and streams - are they better than for loops ...Javantura v4 - Java and lambdas and streams - are they better than for loops ...
Javantura v4 - Java and lambdas and streams - are they better than for loops ...
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
 
Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applications
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann
 
React-js
React-jsReact-js
React-js
 

Similar to Javaone 2014

Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12Enkitec
 
Five Ways Automation Has Increased Application Deployment and Changed Culture
Five Ways Automation Has Increased Application Deployment and Changed CultureFive Ways Automation Has Increased Application Deployment and Changed Culture
Five Ways Automation Has Increased Application Deployment and Changed CultureXebiaLabs
 
Alm Specialist Toolkit Team System 2008 Deep Dive
Alm Specialist Toolkit   Team System 2008 Deep DiveAlm Specialist Toolkit   Team System 2008 Deep Dive
Alm Specialist Toolkit Team System 2008 Deep DiveChristian Thilmany
 
Succeding with the Apache SOA stack
Succeding with the Apache SOA stackSucceding with the Apache SOA stack
Succeding with the Apache SOA stackJohan Edstrom
 
Was l iberty for java batch and jsr352
Was l iberty for java batch and jsr352Was l iberty for java batch and jsr352
Was l iberty for java batch and jsr352sflynn073
 
DOs and DONTs on the way to 10M users
DOs and DONTs on the way to 10M usersDOs and DONTs on the way to 10M users
DOs and DONTs on the way to 10M usersYoav Avrahami
 
Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)Steve Lange
 
Virtualising Tier 1 Apps
Virtualising Tier 1 AppsVirtualising Tier 1 Apps
Virtualising Tier 1 AppsIwan Rahabok
 
[DevDay2018] Automate database migration using flyway framework - By Karthick...
[DevDay2018] Automate database migration using flyway framework - By Karthick...[DevDay2018] Automate database migration using flyway framework - By Karthick...
[DevDay2018] Automate database migration using flyway framework - By Karthick...DevDay.org
 
VAST 7.5 and Beyond
VAST 7.5 and BeyondVAST 7.5 and Beyond
VAST 7.5 and BeyondESUG
 
Architecture in real
Architecture in realArchitecture in real
Architecture in realMichael Chen
 
Evoloution of Ideas
Evoloution of IdeasEvoloution of Ideas
Evoloution of IdeasWooga
 
Java 8 - New Updates and Why It Matters?
Java 8 - New Updates and Why It Matters?Java 8 - New Updates and Why It Matters?
Java 8 - New Updates and Why It Matters?CTE Solutions Inc.
 
Short Introduction of software engineering for bioinformatics
Short Introduction of software engineering for bioinformatics Short Introduction of software engineering for bioinformatics
Short Introduction of software engineering for bioinformatics 丈 宮本
 
Accelerate application delivery with docker containers and windows server 2016
Accelerate application delivery with docker containers and windows server 2016Accelerate application delivery with docker containers and windows server 2016
Accelerate application delivery with docker containers and windows server 2016Taylor Brown
 
BDD and Test Automation in Evalutionary Product Suite
BDD and Test Automation in Evalutionary Product SuiteBDD and Test Automation in Evalutionary Product Suite
BDD and Test Automation in Evalutionary Product SuiteLasantha Ranaweera
 
System Center Orchestrator 2012 Overview
System Center Orchestrator 2012 OverviewSystem Center Orchestrator 2012 Overview
System Center Orchestrator 2012 OverviewAmit Gatenyo
 
2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficientlyBruno Capuano
 

Similar to Javaone 2014 (20)

Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12
 
Five Ways Automation Has Increased Application Deployment and Changed Culture
Five Ways Automation Has Increased Application Deployment and Changed CultureFive Ways Automation Has Increased Application Deployment and Changed Culture
Five Ways Automation Has Increased Application Deployment and Changed Culture
 
Alm Specialist Toolkit Team System 2008 Deep Dive
Alm Specialist Toolkit   Team System 2008 Deep DiveAlm Specialist Toolkit   Team System 2008 Deep Dive
Alm Specialist Toolkit Team System 2008 Deep Dive
 
Succeding with the Apache SOA stack
Succeding with the Apache SOA stackSucceding with the Apache SOA stack
Succeding with the Apache SOA stack
 
Was l iberty for java batch and jsr352
Was l iberty for java batch and jsr352Was l iberty for java batch and jsr352
Was l iberty for java batch and jsr352
 
javazone 2014
javazone 2014javazone 2014
javazone 2014
 
DOs and DONTs on the way to 10M users
DOs and DONTs on the way to 10M usersDOs and DONTs on the way to 10M users
DOs and DONTs on the way to 10M users
 
Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)
 
Virtualising Tier 1 Apps
Virtualising Tier 1 AppsVirtualising Tier 1 Apps
Virtualising Tier 1 Apps
 
[DevDay2018] Automate database migration using flyway framework - By Karthick...
[DevDay2018] Automate database migration using flyway framework - By Karthick...[DevDay2018] Automate database migration using flyway framework - By Karthick...
[DevDay2018] Automate database migration using flyway framework - By Karthick...
 
VAST 7.5 and Beyond
VAST 7.5 and BeyondVAST 7.5 and Beyond
VAST 7.5 and Beyond
 
Architecture in real
Architecture in realArchitecture in real
Architecture in real
 
Evoloution of Ideas
Evoloution of IdeasEvoloution of Ideas
Evoloution of Ideas
 
Java 8 - New Updates and Why It Matters?
Java 8 - New Updates and Why It Matters?Java 8 - New Updates and Why It Matters?
Java 8 - New Updates and Why It Matters?
 
Short Introduction of software engineering for bioinformatics
Short Introduction of software engineering for bioinformatics Short Introduction of software engineering for bioinformatics
Short Introduction of software engineering for bioinformatics
 
quality_forum
quality_forumquality_forum
quality_forum
 
Accelerate application delivery with docker containers and windows server 2016
Accelerate application delivery with docker containers and windows server 2016Accelerate application delivery with docker containers and windows server 2016
Accelerate application delivery with docker containers and windows server 2016
 
BDD and Test Automation in Evalutionary Product Suite
BDD and Test Automation in Evalutionary Product SuiteBDD and Test Automation in Evalutionary Product Suite
BDD and Test Automation in Evalutionary Product Suite
 
System Center Orchestrator 2012 Overview
System Center Orchestrator 2012 OverviewSystem Center Orchestrator 2012 Overview
System Center Orchestrator 2012 Overview
 
2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently
 

Javaone 2014