Similar to <https://dbup.readthedocs.io/en/latest/...
# getting-started
n
d
If you are on the JVM I'd recommend Flyway: https://flywaydb.org/
m
yes, that or Liquibase
n
Looks like what I want, but is it free?
m
it has both free and paid options
n
Got it, looks like it can do just fine with the free option, the paid stuff are things like advanced auth and storing migrations in various cloud storage providers.
d
Yes, I've never needed anything beyond the free version
n
Is it something you run as part of your deploy step?
That's basically what I'm looking for
d
You can either do that (run it standalone using the
flyway
CLI), or you can just add it as a maven dependency and call it programmatically from within your application before starting up
n
Thanks. Do you have any opinion on Liquibase vs Flyway?
d
I haven't used Liquibase. Looking at it, Liquibase requires you to write XML and... yeah no thank you. With Flyway you just write the SQL to perform the necessary changes.
Ah, no, Liquibase has SQL, too. Then I can't really comment 😄
a
Liquibase is my favourite
also you can write yaml, json, xml, or sql
n
+1 for LiquiBase. the XML really isn't that bad, and yeah you do have to (get to?) write SQL sometimes...some of the more advanced features (triggers) are only covered in the pro version, but writing your own SQL is an easy workaround.
n
I prefer writing SQL actually, I've found in general getting as close to the SQL as possible makes debugging so much easier down the road.
n
fair point -- so with LiquiBase you can run the "update" target and it just connects and executes the code, but if you run "updateSQL" it spits out all the SQL it will execute. I review this and copy-paste this into my code reviews, so we know exactly what it's doing
and, there's a futureRollbackSQL command that emits the SQL needed to rollback the change if/when it goes live. I also include that in the code review, so that worst case we can panic and easily find the SQL we need to run directly
m
i have been using liquibase for more than a year and also contributed some code to it. this being said, i don’t think it’s really kotlin-friendly for one main reason: it does not support adding a non-nullable column to a table in a single changeset, which means that you have to add properties in two steps if they are meant to be not nullable: • add them as nullable --> deploy • remove the ? to make them non-nullable --> another deployment
apart from this, it works pretty well in my environment, we run the changelog generation inside gradle builds and apply the changes upon production deployments, it’s (almost) entirely transparent to us