SlideShare una empresa de Scribd logo
1 de 44
The agile database migration framework for Java




                                                                        @axelfontaine
Axel Fontaine                                                         axelfontaine.com
Software Development Expert                                  business@axelfontaine.com
THE PLAN
WARNING!

Disruptive thinking
ahead!
The Problem
addAgeToAccount.sql
?
?   DB
DEV                                                                                              PROD




                                               ?


      http://digitalcitizen.ca/2009/06/22/simpsons-profile-pics-for-facebook-and-other-applications/
VS
DML        DDL
Problems for the DBA


  • Little understanding of context
  • Coordination with app deployer
  • Monkey work
  • Poor use of expertise
  • Poor working hours
Problems for DEV


  • Late review of changes
  • Manual step with friction
  • Less likely to change DB structure
  • Code and DB diverge
  • Incompatible with Continuous Deployment
Goals
                                Goals
• Cooperation between DEV and DBA
• Use full power of the DB
• (Almost) no lock-in
• Integrate in app so you can forget about it
• Descent working hours for everyone
flywaydb.org
6
               commands

clean   info    migrate   validate   init   repair
Empty DB   Version 1   Version 2
Flyway flyway = new Flyway();
flyway.setDataSource(myDataSource);
flyway.migrate();
Demo
DEV
      Migrate   PROD
        on
      Startup
Existing Production Database



                                align



             DEV         TEST           PROD




         V1__Dump.sql
Existing Production Database



                                align



             DEV         TEST           PROD




         V1__Dump.sql
Existing Production Database



                                align



                 DEV     TEST           PROD



       migrate




         V1__Dump.sql
Existing Production Database



                                align



                 DEV     TEST           PROD



       migrate




         V1__Dump.sql
Java Migrations

public class V1_2__Another_user implements JdbcMigration {


    public void migrate(Connection conn) throws Exception {
      PreparedStatement stmt = conn.prepareStatement(“…");

        try {
           stmt.execute();
        } finally {
           stmt.close();
        }
    }
}
Multiple Locations




               http://www.flickr.com/photos/nrivera/3158808122/
Backwards Compatible
Migrations
DB   Backup
DB   Backup
DB
DB
DB
Example

Rename column
 Surname -> Last_Name
Surname             Last_Name



          Surname




                ALTER TABLE … RENAME COLUMN
Last_Name                       Last_Name



Surname                       Last_Name




          ALTER TABLE …                  DROP TRIGGER …
            ADD COLUMN Last_Name         ALTER TABLE …
          UPDATE … SET Last_Name = Surname DROP COLUMN Surname
          CREATE TRIGGER …
Last_Name



Last_Name




        DROP TRIGGER …
        ALTER TABLE …
          DROP COLUMN Surname
Roadmap




   2.1    2.2   3.0
1 day course


 Effective Database
Migrations with Flyway




flywaydb.org/support/training.html
flywaydb.org
@axelfontaine
Axel Fontaine                          axelfontaine.com
Software Development Expert   business@axelfontaine.com

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Database Change Management as a Service
Database Change Management as a ServiceDatabase Change Management as a Service
Database Change Management as a Service
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
 
Database Migrations with Gradle and Liquibase
Database Migrations with Gradle and LiquibaseDatabase Migrations with Gradle and Liquibase
Database Migrations with Gradle and Liquibase
 
Agile Database Development with Liquibase
Agile Database Development with LiquibaseAgile Database Development with Liquibase
Agile Database Development with Liquibase
 
Database versioning with liquibase
Database versioning with liquibaseDatabase versioning with liquibase
Database versioning with liquibase
 
Liquibase for java developers
Liquibase for java developersLiquibase for java developers
Liquibase for java developers
 
CFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful CodeCFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful Code
 
A Tour of the Modern Java Platform
A Tour of the Modern Java PlatformA Tour of the Modern Java Platform
A Tour of the Modern Java Platform
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)
 
Social Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoSocial Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and Domino
 
Java 9 Module System Introduction
Java 9 Module System IntroductionJava 9 Module System Introduction
Java 9 Module System Introduction
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Meetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTMeetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDT
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
Infinum Android Talks #09 - DBFlow ORM
Infinum Android Talks #09 - DBFlow ORMInfinum Android Talks #09 - DBFlow ORM
Infinum Android Talks #09 - DBFlow ORM
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsPerformance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React Applications
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Scala play-framework
Scala play-frameworkScala play-framework
Scala play-framework
 
Java 8 and 9 in Anger
Java 8 and 9 in AngerJava 8 and 9 in Anger
Java 8 and 9 in Anger
 

Destacado

Destacado (14)

Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der DatenbankmigrationstoolsJavaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
 
LiquiBase
LiquiBaseLiquiBase
LiquiBase
 
Architecting for continuous delivery (33rd Degree)
Architecting for continuous delivery (33rd Degree)Architecting for continuous delivery (33rd Degree)
Architecting for continuous delivery (33rd Degree)
 
Database Refactoring With Liquibase
Database Refactoring With LiquibaseDatabase Refactoring With Liquibase
Database Refactoring With Liquibase
 
Liquibase migration for data bases
Liquibase migration for data basesLiquibase migration for data bases
Liquibase migration for data bases
 
Liquibase
LiquibaseLiquibase
Liquibase
 
Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!
 
Liquibase
LiquibaseLiquibase
Liquibase
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSL
 
MyBatis
MyBatisMyBatis
MyBatis
 
Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
presentation slide
presentation slidepresentation slide
presentation slide
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
 

Similar a Flyway: The agile database migration framework for Java

Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.
Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.
Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.
DrupalCampDN
 
Jmorrow rtv den_auto_config_rapidclone
Jmorrow rtv den_auto_config_rapidcloneJmorrow rtv den_auto_config_rapidclone
Jmorrow rtv den_auto_config_rapidclone
Mlx Le
 

Similar a Flyway: The agile database migration framework for Java (20)

Evolutionary Database Design
Evolutionary Database DesignEvolutionary Database Design
Evolutionary Database Design
 
Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)
 
Javaone 2014
Javaone 2014Javaone 2014
Javaone 2014
 
Offline Html5 3days
Offline Html5 3daysOffline Html5 3days
Offline Html5 3days
 
Obevo Javasig.pptx
Obevo Javasig.pptxObevo Javasig.pptx
Obevo Javasig.pptx
 
Database deployments - dotnetsheff
Database deployments - dotnetsheffDatabase deployments - dotnetsheff
Database deployments - dotnetsheff
 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015
 
Enterprise db-change-management&deployment-demo
Enterprise db-change-management&deployment-demoEnterprise db-change-management&deployment-demo
Enterprise db-change-management&deployment-demo
 
為什麼Method數超過65535會build fail?
為什麼Method數超過65535會build fail?為什麼Method數超過65535會build fail?
為什麼Method數超過65535會build fail?
 
Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.
Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.
Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.
 
Db trends final
Db trends   finalDb trends   final
Db trends final
 
Database CI/CD Pipeline
Database CI/CD PipelineDatabase CI/CD Pipeline
Database CI/CD Pipeline
 
Copy Data Management for the DBA
Copy Data Management for the DBACopy Data Management for the DBA
Copy Data Management for the DBA
 
DevOps Drive-In: Automate Database Deployments in Your Continuous Delivery Pi...
DevOps Drive-In: Automate Database Deployments in Your Continuous Delivery Pi...DevOps Drive-In: Automate Database Deployments in Your Continuous Delivery Pi...
DevOps Drive-In: Automate Database Deployments in Your Continuous Delivery Pi...
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next Frontier
 
Dao example
Dao exampleDao example
Dao example
 
Jmorrow rtv den_auto_config_rapidclone
Jmorrow rtv den_auto_config_rapidcloneJmorrow rtv den_auto_config_rapidclone
Jmorrow rtv den_auto_config_rapidclone
 
Play framework
Play frameworkPlay framework
Play framework
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Data Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloningData Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloning
 

Más de Axel Fontaine

Architecting for Continuous Delivery
Architecting for Continuous DeliveryArchitecting for Continuous Delivery
Architecting for Continuous Delivery
Axel Fontaine
 

Más de Axel Fontaine (8)

Immutable Infrastructure: the new App Deployment
Immutable Infrastructure: the new App DeploymentImmutable Infrastructure: the new App Deployment
Immutable Infrastructure: the new App Deployment
 
Jfokus 2015 - Immutable Server generation: the new App Deployment
Jfokus 2015 - Immutable Server generation: the new App DeploymentJfokus 2015 - Immutable Server generation: the new App Deployment
Jfokus 2015 - Immutable Server generation: the new App Deployment
 
Continuous Delivery and Zero Downtime: What your architecture needs to succeed
Continuous Delivery and Zero Downtime: What your architecture needs to succeedContinuous Delivery and Zero Downtime: What your architecture needs to succeed
Continuous Delivery and Zero Downtime: What your architecture needs to succeed
 
Immutable Server generation: The new App Deployment
Immutable Server generation: The new App DeploymentImmutable Server generation: The new App Deployment
Immutable Server generation: The new App Deployment
 
Continuous Delivery and Zero Downtime
Continuous Delivery and Zero DowntimeContinuous Delivery and Zero Downtime
Continuous Delivery and Zero Downtime
 
XP Days Ukraine 2013 - Architecting for Continuous Delivery
XP Days Ukraine 2013 - Architecting for Continuous DeliveryXP Days Ukraine 2013 - Architecting for Continuous Delivery
XP Days Ukraine 2013 - Architecting for Continuous Delivery
 
Architecting for Continuous Delivery
Architecting for Continuous DeliveryArchitecting for Continuous Delivery
Architecting for Continuous Delivery
 
Continuous Delivery
Continuous DeliveryContinuous Delivery
Continuous Delivery
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Flyway: The agile database migration framework for Java

Notas del editor

  1. Plain Old SQLConvention Over ConfigurationFail fastZero-required dependenciesJava 5+ and JDBC driverDeceivingly simple, yet surprisingly powerful