sorentwo / oban

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

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

Closed shamanime closed 2 months ago

shamanime commented 2 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 2 months ago

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