Question

I have a PostgreSQL Database that is setup using Liquibase. When I run liquibase:dropAll using maven it drop me everything but trigger functions. Is there a way that with that maven goal also triggerfunctions are dropped?

Since when I reapply my changeset after the dropAll it fails to create the already existing functions.

Was it helpful?

Solution

Unfortuantely no. The way dropAll is implemented is that it uses the liquibase snapshot function to find all objects to drop which works fine except for object types not looked for by snapshot. Snapshot handles standard types like tables, columns, views, and sequences but does not get into more database-specific types like triggers, functions, procedures, user defined types, etc. Since snapshot does not know about triggers, dropAll cannot know to drop them.

If you are using postgresql, the easiest way may be to just run

drop schema public cascade;
create schema public;

as described in "Drop all tables in PostgreSQL?" rather than use liqubase dropAll.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top