oban-bg / oban

💎 Robust job processing in Elixir, backed by modern PostgreSQL and SQLite3
https://oban.pro
Apache License 2.0
3.37k stars 313 forks source link

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

Closed shamanime closed 7 months ago

shamanime commented 7 months ago

Environment

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.

sorentwo commented 7 months ago

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