Exists-preconditions, offline databases and generated SQL

We use an offline database to programmatically create a changelog and then we generate DDL using Liquibase.

However, we have encountered a weakness in the pre-condition system

  • it requires a snapshot for offline databases, which we don’t have.

BASIC NEED

We want to generate DDL to drop tables, views, etc (before re-creating them), but only try to drop if they exists.

However, most databases already have a syntax for this: “DROP VIEW IF EXISTS” in mysql, for instance. For some databases, more elaborate DDL would presumably need to be generated.

SUGGESTED SOLUTION

Add an checkExists flag to the DROP refactorings. If set, it will -

whenever supported by the database - generate DDL statements that checks if object existence, such as “DROP VIEW IF EXISTS”.

Thanks.