Flyway: The agile database migration framework for Java

  • 2,955 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • @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.
    Are you sure you want to
    Your message goes here
  • I work with Flyway for 1 year and I must say this presentation is misty and unclear
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
2,955
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
2
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Plain Old SQLConvention Over ConfigurationFail fastZero-required dependenciesJava 5+ and JDBC driverDeceivingly simple, yet surprisingly powerful

Transcript

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