Keeping database schemas up-to-date with Flyway

Home » Blog » Software » Enterprise Software » Keeping database schemas up-to-date with Flyway

At least ever since Ruby on RailsActive Record Migrations put an emphasis on keeping database schemas consistent with your software’s source code both during development and in production database migration tools have become a staple in modern software development.

Database migration (or database refactoring as this technique is sometimes called as well) tools allow you to apply data definition language (DDL) statements like “CREATE TABLE …” or “ALTER …” to databases in an automated, consistent and traceable manner instead of either having every developer involved change the database schema whenever he or she sees fit or – probably even worse – requiring a DBA to review and approve each and every database change however minute, an approach which favours stability over change at all costs and hence severely hampers development speed.

If you worked without automated database migrations you’d have to apply structural database changes required by software changes manually. Not only are manual changes tedious and hence should be automated (see the Three Virtues) but they’re also error-prone in that they tend to be forgotten as well as often work differently in different environments such as production servers.

Using such a tool in your daily development process therefore really is a no-brainer.

For Java environments there’s a variety of different tools for this purpose, like Liquibase for example.

A particularly simple and easy-to-use database migration tool for Java however is
Flyway, which enables you to “evolve your database schema easily and reliably across all your instances“. The Flyway website explains in easy terms why database migrations are useful in the first place and how Flyway approaches this important component of the software development process.

Flyway can be used in various ways like purely as a command-line tool, as a Maven plugin, via Ant or Gradle and even programmatically from your Java code.

In order to do its work Flyway adds a simple schema_version table to your database that contains metadata about the current version of the database and the migrations that have already been applied to it.

The one aspect that makes Flyway particularly stand out from competing tools is that it uses plain and simple SQL scripts in order to apply migrations. No weird DSLs or XML dialects to learn! Just use SQL like you’re used to!

If you’d like to know more about best practices regarding Flyway and database migrations in general please subscribe to this mailing list for more information on my upcoming guide “Database migrations with Flyway – Getting Started“:

* indicates required

Leave a Comment

* Checkbox GDPR is required


I agree

By continuing to browse the site you agree to our use of cookies. Privacy Policy

Privacy Preference Center

Strictly necessary

These cookies are necessary for the site to function.

PHPSESSID: Preserves user session state across page requests.

__cfduid: Used by the content network, Cloudflare, to identify trusted web traffic.



Remembers the user's submitted data when a comment is submitted in a blog post. The purpose is to aut o-populate form fields for subsequent comments, in order to save time for the user.



Statistic cookies help us to understand how visitors interact with our websites by collecting and reporting information anonymously.

_ga: Registers a unique ID that is used to generate statistical data on how the visitor uses the website.

_gat: Used by Google Analytics to throttle request rate.

_gid: Registers a unique ID that is used to generate statistical data on how the visitor uses the website.

collect: Used to send data to Google Analytics about the visitor's device and behaviour. Tracks the visitor across d evices and marketing channels.



We use Wordfence to secure our website against hacking attempts:


Close your account?

Your account will be closed and all data will be permanently deleted and cannot be recovered. Are you sure?