I’ve started using preconditions to do simple existence checks in front of refactorings like create table, create index, etc. The problem is that our dev environments have different flavors of the db, in various states (some at the result of bad dev testing). As we begin to use Liquibase to enforce future schema integrity, even if a table exists, it doesn’t necessarily exist with the proper schema today.
I’d like to detect the schema differences in our Liquibase run so that the next day we can decide to either destroy a corrupt dev db, or assign devs to write changesets that convert a bad schema+data to the proper form. And I want to be very detailed, for example: verify a given column has the correct data type/length, nullability, and default value.
So how can I approach this? Has anyone tackled this before?
I have an idea but I wanted to hear what the community thinks first.