There isn’t currently a data type precondition, but you could create your own using the extension system (liqubase.org/extensions).
You could probably also override the change types you use and have the precondition built in so you don’t need to specify it in the changeSet. It does definitely go against the normal liquibase usage, but you are also already there
I do not keep multiple xml files for changes in the database but instead just update only one single xml for each table, which I execute always ( in my application start-up )
This table xml is built in order to ‘detect’ any database changes and execute only the modifications
- The logic is simple and based to preconditions
- If table does not exist (precondition not->tableExists) create it with all the required columns
- else for every column ( 2 changesets )
- if column does not exist (precondition not->columnExists) add it
- if column exists modify the data type to the latest one ( HERE IS THE PROBLEM )
The problem is that the last data type modification is executed always since there is no such a precondition
( e.g columnDataTypeEquals )
I am attaching the xml I use for a simple 2 column table TEST_TABLE ( id, test_column)