Marc Rufer bio photo

Marc Rufer

Software engineer
@d-fens GmbH

Twitter LinkedIn Github Stackoverflow
RSS Feed

First steps with Flyway

Marc Rufer 18 Apr 2015 database migration Flyway maven development

After reading a blog post about the database migration tool Flyway on jaxenter I decided to play around with it in the context of a little sample project. The sample project shows the usage of the flyway maven plugin in combination with a h2 database.

About Flyway

Flyway logo

A short introduction about database migrations can be found here. To get some basic information about Flyway and how it works have a look at How Flyway works @Flywaydb.org.

For more details have a look at the Flyway documentation

Getting started

To set up the sample project I had a look into the Get started with maven guide. With the information provided there the setup was straight forward. The configuration of the maven plugin is pretty intelligible and the configuration tags are documented well.

Below you can see the pom-file of my sample project

The database migration files by default have to follow the pattern V{VERSION_NUMBER}_{NAME_OF_THE_FILE}.sql and have to be placed in the migration directory src/main/resources/db/migration.

The sources of the sample project can be found on my GitHub-Account.

Flyway and spring boot

Spring boot supports flyway database migrations by running them automatically on startup. For more information have a look at the Spring boot documentation.

Conclusion

The configuration of the maven plugin was very straight forward and the plugin worked well for my little sample. On the flyway website you can find some get started tutorials for command line, java API, Maven, Gradle, Ant and SBT. These tutorials are good starting point for everybody who wants to check out the basic functionalities of Flyway.

Furthermore the flyway website provides a lot of information around flyway, which are easy to find thanks to a clear structure.

comments powered by Disqus

Posts

HOWTO Access Azure File Share in PowerShell Script executed by a Scheduled Task BUG "Task Scheduler service is not available" Error, if specifying Network Connection Condition HOWTO Sync OneDrive on Server even if Windows User not logged in HOWTO Access Microsoft Access Database with PowerShell Get NetworkCredential from PSCredential splits Username into Username and Domain HOWTO Create LocalDB File (.mdf) manually in Visual Studio 2015 HOWTO Set Cookie Header on DefaultRequestHeaders of HttpClient HOWTO Set up PowerShell Remote Session Configuration HOWTO Analyze PowerShell Scripts with PSScriptAnalyzer HOWTO Sign PDF with SuisseID NoBrainer PUT/PATCH/MERGE with OData Service Client Apply Commit from one Repository to another GitHub Repository creation with PowerShell HOWTO Sign PowerShell Script with SuisseID Swissunihockey game schedule PDF generator HOWTO Maven Release on JetBrains TeamCity Limitations when running Activiti in H2 Embedded Mode HOWTO Pylint Integration in IntelliJ 14 HOWTO Install Windows 10 IoT Core on Raspberry PI 2 from a VM First steps with Dropwizard Allman code style for IntelliJ First steps with Flyway IntelliJ - Setup custom inspection profiles Configuration properties meta-data support in IntelliJ AMQP Integration with spring integration OCA Java SE 7 Programmer I Certification Guide Swissunihockey key matcher Swisscom SMS-API-Client Some hints concerning logging with Log4j IFTTT A brilliant service Run deltacloud on a VirtualBox-VM Project specific maven settings in IntelliJ AngularJS Javascript for beginners Liferay in Action