The agile database migration framework for Java                                                                        @ax...
THE PLAN
WARNING!Disruptive thinkingahead!
The Problem
addAgeToAccount.sql
??   DB
DEV                                                                                              PROD                     ...
VSDML        DDL
Problems for the DBA  • Little understanding of context  • Coordination with app deployer  • Monkey work  • Poor use of ex...
Problems for DEV  • Late review of changes  • Manual step with friction  • Less likely to change DB structure  • Code and ...
Goals                                Goals• Cooperation between DEV and DBA• Use full power of the DB• (Almost) no lock-in...
flywaydb.org
6               commandsclean   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__...
Existing Production Database                                align             DEV         TEST           PROD         V1__...
Existing Production Database                                align                 DEV     TEST           PROD       migrat...
Existing Production Database                                align                 DEV     TEST           PROD       migrat...
Java Migrationspublic class V1_2__Another_user implements JdbcMigration {    public void migrate(Connection conn) throws E...
Multiple Locations               http://www.flickr.com/photos/nrivera/3158808122/
Backwards CompatibleMigrations
DB   Backup
DB   Backup
DB
DB
DB
ExampleRename column Surname -> Last_Name
Surname             Last_Name          Surname                ALTER TABLE … RENAME COLUMN
Last_Name                       Last_NameSurname                       Last_Name          ALTER TABLE …                  D...
Last_NameLast_Name        DROP TRIGGER …        ALTER TABLE …          DROP COLUMN Surname
Roadmap   2.1    2.2   3.0
1 day course Effective DatabaseMigrations with Flywayflywaydb.org/support/training.html
flywaydb.org
@axelfontaineAxel Fontaine                          axelfontaine.comSoftware Development Expert   business@axelfontaine.com
Flyway: The agile database migration framework for Java
Flyway: The agile database migration framework for Java
Flyway: The agile database migration framework for Java
Flyway: The agile database migration framework for Java
Flyway: The agile database migration framework for Java
Flyway: The agile database migration framework for Java
Flyway: The agile database migration framework for Java
Upcoming SlideShare
Loading in...5
×

Flyway: The agile database migration framework for Java

3,602

Published on

Published in: Technology
2 Comments
5 Likes
Statistics
Notes
  • @alexnenko As you no doubt have guessed, my slides are there to support my talk. Not the other way around. They therefore have limited use by themselves. Having them online primarily serves as a memory aid for the ones who attended the presentation.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I work with Flyway for 1 year and I must say this presentation is misty and unclear
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
3,602
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
2
Likes
5
Embeds 0
No embeds

No notes for slide
  • Plain Old SQLConvention Over ConfigurationFail fastZero-required dependenciesJava 5+ and JDBC driverDeceivingly simple, yet surprisingly powerful
  • Flyway: The agile database migration framework for Java

    1. 1. The agile database migration framework for Java @axelfontaineAxel Fontaine axelfontaine.comSoftware Development Expert business@axelfontaine.com
    2. 2. THE PLAN
    3. 3. WARNING!Disruptive thinkingahead!
    4. 4. The Problem
    5. 5. addAgeToAccount.sql
    6. 6. ?? DB
    7. 7. DEV PROD ? http://digitalcitizen.ca/2009/06/22/simpsons-profile-pics-for-facebook-and-other-applications/
    8. 8. VSDML DDL
    9. 9. Problems for the DBA • Little understanding of context • Coordination with app deployer • Monkey work • Poor use of expertise • Poor working hours
    10. 10. 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
    11. 11. 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
    12. 12. flywaydb.org
    13. 13. 6 commandsclean info migrate validate init repair
    14. 14. Empty DB Version 1 Version 2
    15. 15. Flyway flyway = new Flyway();flyway.setDataSource(myDataSource);flyway.migrate();
    16. 16. Demo
    17. 17. DEV Migrate PROD on Startup
    18. 18. Existing Production Database align DEV TEST PROD V1__Dump.sql
    19. 19. Existing Production Database align DEV TEST PROD V1__Dump.sql
    20. 20. Existing Production Database align DEV TEST PROD migrate V1__Dump.sql
    21. 21. Existing Production Database align DEV TEST PROD migrate V1__Dump.sql
    22. 22. Java Migrationspublic class V1_2__Another_user implements JdbcMigration { public void migrate(Connection conn) throws Exception { PreparedStatement stmt = conn.prepareStatement(“…"); try { stmt.execute(); } finally { stmt.close(); } }}
    23. 23. Multiple Locations http://www.flickr.com/photos/nrivera/3158808122/
    24. 24. Backwards CompatibleMigrations
    25. 25. DB Backup
    26. 26. DB Backup
    27. 27. DB
    28. 28. DB
    29. 29. DB
    30. 30. ExampleRename column Surname -> Last_Name
    31. 31. Surname Last_Name Surname ALTER TABLE … RENAME COLUMN
    32. 32. Last_Name Last_NameSurname Last_Name ALTER TABLE … DROP TRIGGER … ADD COLUMN Last_Name ALTER TABLE … UPDATE … SET Last_Name = Surname DROP COLUMN Surname CREATE TRIGGER …
    33. 33. Last_NameLast_Name DROP TRIGGER … ALTER TABLE … DROP COLUMN Surname
    34. 34. Roadmap 2.1 2.2 3.0
    35. 35. 1 day course Effective DatabaseMigrations with Flywayflywaydb.org/support/training.html
    36. 36. flywaydb.org
    37. 37. @axelfontaineAxel Fontaine axelfontaine.comSoftware Development Expert business@axelfontaine.com

    ×