oban-bg/oban

Oban Pro v1.4 Workflow migration fails on Postgres 13 trigger creation

Closed this issue · 1 comments

Environment

  • Oban Version: 1.4.4
  • PostgreSQL Version: 13
  • Elixir & Erlang/OTP Versions (elixir --version): 1.16 OTP 26

Current Behavior

Postgres 13 does not support OR REPLACE for triggers.

** (Postgrex.Error) ERROR 42601 (syntax_error) syntax error at or near "TRIGGER"

    query: CREATE OR REPLACE TRIGGER oban_workflow_trigger
AFTER DELETE ON "public".oban_jobs
FOR EACH ROW
WHEN (
  OLD.state::text NOT IN ('cancelled', 'completed', 'discarded')
  AND OLD.meta ? 'workflow_id'
)
EXECUTE FUNCTION "public".oban_workflow_cleanup();

Expected Behavior

Migration should work with Postgres 13.

Thanks for the report! Fixed in the just-released Pro v1.4.5