Вопрос

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.

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top