Verify correct db version when application starts up

Is there a way I can verify whether the current application is compatible with the current database version ?

Should I use database tags for that, linking the latest tag in my application code and verifying if that tag has been applied on the database ?
How can I force this during development time between 2 releases ? I assume tagging a database for every changeset during development is not the way forward ?

Any other means ?

Regards, Bert.

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).

Nathan