It is generally best to not think about database “versions”. It gets messy quickly when you have multiple branches of your codebase evolving at the same time. The idea behind liquibase is that you have a set of changes that need to have been applied to a database to have it compatible with the current version. When your application starts up, you can run the “update” command which will see which of those changes have been ran before, and which have not and apply any un-ran changes so it is compatible with the codebase. You don’t have to do any version comparison because any past version can be made compatible with the current version.
If you are wondering if a database would need to be updated, there is a liquibase.Liquibase.listUnrunChangeSets() method you can call programatically on application startup (or through the command line or another offline before starting your application).