I faced a performance issues with some of the core preconditions (tableExists, indexExists). These preconditions obtain a snapshot of the db and try to check whether it has specific object.
I decided to work on the liquibase extension for my db type and to implement a precondition that can execute the check more efficiently (since it knows the structure of system tables/views and can query them directly).
I registered the precondition in the /resources/META-INF/services/liquibase.precondition.Precondition and it works like a charm for my db.
Unfortunately, we need to support another db type as well, plus h2 for testing. In these cases, I want to fallback to core precondition, or that one that was written for this db type.
DataTypes have convenient methods for this case:
public int getPriority() public boolean supports(Database database)
but I can’t find anything similar for the Preconditions.
Is there a way to enable overridden precondition only liquibase runs on specific db?