r/SpringBoot • u/themasterengineeer • Feb 19 '25
Guide DB migration in Springboot
It might be a it of a niche topic but found this video to be very useful. It shows how to use Flyway ( a DB migration tool) with Springboot.
I think it is a nice expansion to our personal projects portfolio.
3
u/Firearms_N_Freedom Feb 19 '25
is it bad that i do it manually using postgres and SQL scripts for my heroku postgres DB? i will definitely look into this and get comfortable with it though.
3
u/Zeeboozaza Feb 19 '25
If it’s a small personal project it’s not bad, but if it’s more than that you should certainly have something like flyway or liquibase handle it for you.
2
u/MrDoodl3sack Feb 19 '25
If you have multi stage deployments (e.g. Integration -> QA -> Production) let flyway handle the database updates, ensures that the database looks the same on all stages.
1
u/MrDoodl3sack Feb 19 '25
The flyway and liquibase integration in Spring boot is nice for small projects. When your tables grow I wouldn't use the automatic deployment during the startup anymore. There are certain table operations which create locks or block the service startup, so your service is not responding. In such situations I prefer to execute the flyway or liquibase manually using flyway or liquibase directly.
1
1
2
u/bikeram Feb 19 '25
Does anyone have experience with flyway vs liquibase?
1
u/prab2112 Feb 20 '25
Yes I have flyway is better than liquibase in terms of writing the migration scripts .
0
u/Seven-Prime Feb 19 '25
Just switched from liquibase to flyway.
Folks like flyway because they can just write SQL Folks like liquibase because they don't have to write SQL*.
if they don't want to.
1
Oct 12 '26
[removed] — view removed comment
1
u/Seven-Prime Oct 12 '26
Politics. lol. Well not really I guess.
The microservices we built were under one product group / platform. Then they moved our services to a different product group / platform. The new group used flyway. To ease transition and fit in with the CICD patterns we switched to flyway. The db stuff wasn't all that that much, so it was pretty easy.
0
u/db-master Oct 13 '26
Years ago, when I was building a Java application for a personal project, I compared Liquibase and Flyway and picked Flyway. Liquibase just felt arcane to use.
At my day job, though, neither tool was enough on its own, because both lacked collaboration features. One of my previous companies had an internal tool where developers submitted schema changes, and DBAs reviewed and deployed them.
That tool was the inspiration for Bytebase I built.
0
Feb 20 '25
[deleted]
1
u/prab2112 Feb 20 '25
I agreed learning curve is much in liquibase, also rolling back a migration is better in liquibase
28
u/maxip89 Feb 19 '25
niche? I see this as an industry standard. Or how do you else keep your database up to date?
spoiler alert:
The migration of hibernate you cannot trust.