How to generate liquibase change logs along with basic preconditions ?


I used generateChangeLog command on an existing database. It helped me auto generating ‘create’ changesets for all tables, sequences. 

I am interested to know if there is a way to doing same and get preconditions included using generateChangeLog. Say to include basic precondition like if table or sequence already exists.

I went through liquibase documentation but couldn’t find any help on this. Googled, but couldn’t find much relevant, useful help.

Can anyone let me know if this is possible ?

I can help myself if pointed out to any useful knowledge source too.

Any help is appreciated.

More details:

database: postgres 9.5

liquibase-maven-plugin: 3.4.1

I don’t think this is possible, but sounds like a reasonable change request for

In general, you don’t need to have preconditions for things like ‘table exists’ before the change that creates a a table because liquibase will see that the change to create the table has already been applied, and won’t try to re-apply it. 

If you have an existing database that you are starting to bring under Liquibase management, see the page for some ideas on how to get started. 

Steve Donie
Principal Software Engineer
Datical, Inc.