Database migrations with Flyway and Liquibase
-
Upload
lars-ostling -
Category
Software
-
view
338 -
download
5
Transcript of Database migrations with Flyway and Liquibase
Agenda
• Database migrations
• Flyway
• Liquibase
• Conclusions
Back in the day…
• Big up-front design
• Long development cycles
• Scary updates
In an agile world…
• Short iterations
• Continuous integration /delivery / deployment
• Delivery pipe-lines
• We do it for code …
• … what about the database?
The challenge• Frequent database updates
• Managing multiple sql files
• What has been applied and what has not?
• Keeping code and database in sync …
• … throughout all environments
The solutionAutomated database migrations:
• Recreate database from scratch
• Make it clear at all times what state a database is in
• Migrate in a deterministic way from current version of the database to a newer one
What is Flyway?
• Agile database migration framework for Java
• Open Source Apache 2.0 license
• Started in 2010
• Status ‘Adopt’ on thoughtworks technology radar
• http://www.flywaydb.org
Demohttps://github.com/larsostling/database-migrations-demo
Short recap
• Schema version table
• Convention over configuration
• Sql and java migrations
• Supereasy to setup
What is Liquibase?
• Agile database migration framework for Java
• Open Source Apache 2.0 license
• Started in 2006
• http://www.liquibase.org
Demohttps://github.com/larsostling/database-migrations-demo
Short recap
• Uses structured DSL to describe database changes
• Databasechangelog table
• Supports rollback
• generateChangeLog
Flyway vs. Liquibase
• SQL vs. XML
• Multiple files vs. single file
• No rollback vs. rollback
• KISS vs. less KISS
Some advice
• Migrate on application startup
• Change sets do not change
• People and processes
Lessons learned
• Stop worrying about database changes
• Pick a framework and start using it
Q & A