Clean fails when Postgres DOMAIN depends on SEQUENCE #1802
What version of Flyway are you using?
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)
Reproduced issue with command line client.
What database are you using (type & version)?
What operating system are you using?
What did you do?
(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
CREATE SEQUENCE foo_seq; CREATE DOMAIN foo_seq_dom AS BIGINT NOT NULL DEFAULT nextval('foo_seq');
What did you expect to see?
"flyway clean" successfully cleans schema
What did you see instead?
Database: jdbc:postgresql://localhost/flybug (PostgreSQL 9.6)
The text was updated successfully, but these errors were encountered:
This is a more generic workaround, it works no matter what the sequences are named.
Add the following to beforeClean.sql:
DO LANGUAGE plpgsql $$ DECLARE v_sql TEXT; BEGIN FOR v_sql IN (SELECT FORMAT('DROP SEQUENCE %I CASCADE', SEQUENCE_NAME) FROM INFORMATION_SCHEMA.SEQUENCES WHERE SEQUENCE_SCHEMA = CURRENT_SCHEMA) LOOP EXECUTE v_sql; END LOOP; END; $$;