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

Kubernetes
DevOps
 minutes
Best CI/CD tools for Kubernetes: Streamlining the cluster

Static delivery pipelines are becoming a bottleneck. The best CI/CD tools for Kubernetes are those that move beyond simple code builds to provide total environment orchestration and developer self-service.

Mélanie Dallé
Senior Marketing Manager
DevOps
Cloud
 minutes
Top 10 vSphere alternatives for modern hybrid cloud orchestration

The Broadcom acquisition of VMware has sent shockwaves through the enterprise world, with many organizations facing license cost increases of 2x to 5x. If you are looking to escape rising TCO and rigid subscription bundles, these are the top vSphere alternatives for a modern hybrid cloud.

Mélanie Dallé
Senior Marketing Manager
DevOps
Heroku
 minutes
Top 10 Heroku Postgres competitors for production databases

Escape rising Heroku costs and rigid limitations. Discover the best Heroku Postgres competitors that offer high availability, global scaling, and the flexibility to deploy on your own terms.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
Heroku
 minutes
Top 10 GitLab alternatives for DevOps teams

Is GitLab bloat slowing down your engineering team? Compare the top 10 GitLab alternatives for, from GitHub to lightweight automation platforms like Qovery. Escape the monolith and reclaim your velocity.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
Heroku
 minutes
Heroku vs. Kubernetes: A comprehensive comparison

Is the "Heroku Tax" draining your budget? Compare Heroku vs. Kubernetes in 2026. Learn how to solve complex orchestration challenges, like queue-based autoscaling and microservice sprawl, without the DevOps toil.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
 minutes
The complete guide to migrating from EKS to ECS

Is the EKS operational burden outweighing its benefits? Learn how to migrate from EKS to ECS, the technical trade-offs of AWS-native orchestration, and how to get ECS-level simplicity without losing Kubernetes power.

Mélanie Dallé
Senior Marketing Manager
Kubernetes
DevOps
Platform Engineering
6
 minutes
Kubernetes vs. Docker: Escaping the complexity trap

Is the "Kubernetes Tax" killing your team’s velocity? Compare Docker vs. Kubernetes in 2026 and discover how to get production-grade orchestration with the "Git Push" simplicity of Docker, without the operational toil.

Morgan Perry
Co-founder
DevSecOps
 minutes
Inside Qovery’s security architecture: how we secure your cloud & Kubernetes infrastructure

Discover how Qovery bridges the gap between developers and infrastructure with a "security by design" approach. From federated identities and unique encryption keys to real-time audit logs and SOC2 Type 2 certification - see how we protect your data while eliminating vendor lock-in.

Kevin Pochat
Security & Compliance Engineer

It’s time to rethink
the way you do DevOps

Turn DevOps into your strategic advantage with Qovery, automating the heavy lifting while you stay in control.