Blog
Engineering
3
minutes

Perform Database Schema Migrations in Just 5 min Using Flyway and Spring Boot

At Qovery, we rely on Kotlin with Spring Boot to develop our API and Postgres as a database. When I joined the backend team a couple of months ago, we didn’t have a straightforward solution to handle database migrations. As production access is strictly limited, I had to depend on a teammate with admin rights every time I wanted to update the schema of the database. We needed to find a more appropriate long-term solution, as our team is fast-growing, and managing authorizations is bound to become even more painful. Eventually, we agreed to start using a database-migration tool and picked Flyway as the best tool for this job. The following article is about to show you how easily Flyway can integrate with an existing database using the Spring framework. It is not meant to provide a deep insight into Flyway, nor is it a step-by-step tutorial to set up the tool.
Mélanie Dallé
Senior Marketing Manager
Summary
Twitter icon
linkedin icon

What is Flyway?

Flyway is an open-source database migration tool that can handle more than a dozen SQL databases, including Postgres. It strongly favors simplicity and convention over configuration. Migrations can be written in either SQL or Kotlin, which is extremely useful when you need to migrate data with complex business logic. But most of all, Flyway offers plugins for many Java frameworks, such as Spring Boot—an obvious perk for us at Qovery, as it makes its integration super easy for us. Let me show you how it works!

Step 1 - Importing Flyway Into our Project

In our Gradle file, we need to add Flyway’s plugin and implementation as such:

// Add this Flyway plugin to the plugins section
plugins {
id "org.flywaydb.flyway" version "8.5.5"
}

// Add this Flyway plugin to the plugins section
dependencies {
implementation("org.flywaydb:flyway-core:8.4.3")
}

Step 2 - Updating our Spring Application Properties

For both application.properties files within the main and test folders, we need to add the following lines:

// Set to true if you are going to use Flyway with an existing database 
spring.flyway.baseline-on-migrate=true

// Version to use for the baseline, we used a timestamp of the date when we added Flyway
spring.flyway.baseline-version=1643814687

// Very important to disable the dangerous clean command on production environment
spring.flyway.clean-disabled=true

And that’s pretty much it! With this done, Flyway will create a flyway_schema_history table to store information about the state of your database.

If you are following Flyway’s conventions, you just need to add migration scripts to the src/main/resources/db/migration folder. They will then be executed when the application starts.

To learn more about Flyway’s conventions, feel free to check out their documentation on migrations.

[Bonus] Step 3 - Migration Generator

To make the process even smoother, we created a bash script to generate our migration files while respecting Flyway’s naming convention.

Every migration file’s name starts with V, followed by the version of the migration (in our case, we decided to use a timestamp to keep things simple). It is then followed by __ and the migration name.

Here’s how we create a migration:

> ./scripts/generate_migration AddInstallationIdToUser
> Created: .../src/main/resources/db/migration/V1648999476__add_installation_id_to_user.sql

Conclusion

Flyway has been great so far! All we had to do was set up the tool, go through its documentation to gain a proper understanding of how it works, and... that’s about it! No further tweaking involved! Thanks to this seamless implementation using Spring Boot, our development process has been significantly improved in a short amount of time and with very limited effort.

Share on :
Twitter icon
linkedin icon
Ready to rethink the way you do DevOps?
Qovery is a DevOps automation platform that enables organizations to deliver faster and focus on creating great products.
Book a demo

Suggested articles

Cloud
Heroku
Internal Developer Platform
Platform Engineering
9
 minutes
The Top 8 Platform as a Service (Paas) Tools in 2026

Build Your Own PaaS: Stop depending on fixed cloud offerings. Discover the top 8 tools, including Qovery, Dokku, and Cloud Foundry, that let you build a customizable, low-maintenance PaaS on your cloud infrastructure.

Morgan Perry
Co-founder
Kubernetes
 minutes
How to Deploy a Docker Container on Kubernetes: Step-by-Step Guide

Simplify Kubernetes Deployment. Learn the difficult 6-step manual process for deploying Docker containers to Kubernetes, the friction of YAML and kubectl, and how platform tools like Qovery automate the entire workflow.

Mélanie Dallé
Senior Marketing Manager
Observability
DevOps
 minutes
Observability in DevOps: What is it, Observe vs. Monitoring, Benefits

Observability in DevOps: Diagnose system failures faster. Learn how true observability differs from traditional monitoring. End context-switching, reduce MTTR, and resolve unforeseen issues quickly.

Mélanie Dallé
Senior Marketing Manager
DevOps
Cloud
8
 minutes
6 Best Practices to Automate DevSecOps in Days, Not Months

Integrate security seamlessly into your CI/CD pipeline. Learn the 6 best DevSecOps practices—from Policy as Code to continuous monitoring—and see how Qovery automates compliance and protection without slowing development.

Morgan Perry
Co-founder
Heroku
15
 minutes
Heroku Alternatives: The 10 Best Competitor Platforms

Fed up of rising Heroku costs and frequent outages? This guide compares the top 10 Heroku alternatives and competitors based on features, pricing, pros, and cons—helping developers and tech leaders choose the right PaaS.

Mélanie Dallé
Senior Marketing Manager
Product
Infrastructure Management
Deployment
 minutes
Stop tool sprawl - Welcome to Terraform/OpenTofu support

Provisioning cloud resources shouldn’t require a second stack of tools. With Qovery’s new Terraform and OpenTofu support, you can now define and deploy your infrastructure right alongside your applications. Declaratively, securely, and in one place. No external runners. No glue code. No tool sprawl.

Alessandro Carrano
Head of Product
AI
DevOps
 minutes
Integrating Agentic AI into Your DevOps Workflow

Eliminate non-coding toil with Qovery’s AI DevOps Agent. Discover how shifting from static automation to specialized DevOps AI agents optimizes FinOps, security, and infrastructure management.

Mélanie Dallé
Senior Marketing Manager
DevOps
 minutes
Top 10 Flux CD Alternatives: Finding a Better Way to Deploy Your Code

Looking for a Flux CD alternative? Discover why Qovery stands out as the #1 choice. Compare features, pros, and cons of the top 10 platforms to simplify your deployment strategy and empower your team.

Mélanie Dallé
Senior Marketing Manager

It’s time to rethink
the way you do DevOps

Say goodbye to DevOps overhead. Qovery makes infrastructure effortless, giving you full control without the trouble.