From b902480361735a621a6bb3cc979c78fd8fda6d2a Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 27 Mar 2026 18:14:20 -0500 Subject: [PATCH] fix: add suspended state to oban_job_state enum (#199) Oban 2.18+ introduced the 'suspended' job state for pausing jobs. Oban.Met.Reporter queries for jobs in this state, causing errors when the database enum doesn't include it: ERROR 22P02 (invalid_text_representation) invalid input value for enum oban_job_state: "suspended" This migration adds 'suspended' to the oban_job_state enum type. Required by recent Oban dependency updates (commit 0399b30d). Note: Uses @disable_ddl_transaction since ALTER TYPE ADD VALUE cannot run inside a transaction in PostgreSQL. Reviewed-on: https://git.mcintire.me/graham/towerops-web/pulls/199 --- CHANGELOG.txt | 9 +++++++++ ...231100_add_suspended_to_oban_job_state.exs | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 priv/repo/migrations/20260327231100_add_suspended_to_oban_job_state.exs diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 30e09672..97278e94 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,12 @@ +2026-03-27 +fix: add suspended state to oban_job_state enum + - Oban 2.18+ introduced the 'suspended' job state for pausing jobs + - Oban.Met.Reporter queries for this state, causing PostgreSQL enum errors + - Migration adds 'suspended' to the oban_job_state enum type + - Required by recent Oban dependency updates (commit 0399b30d) + - Fixes GenServer crash: invalid input value for enum oban_job_state: "suspended" + Files: priv/repo/migrations/20260327231100_add_suspended_to_oban_job_state.exs + 2026-03-27 fix: remove duplicate sync_connect option from Phoenix.PubSub.Redis configuration - Phoenix.PubSub.Redis 3.1.0 automatically appends sync_connect: true to redis_opts diff --git a/priv/repo/migrations/20260327231100_add_suspended_to_oban_job_state.exs b/priv/repo/migrations/20260327231100_add_suspended_to_oban_job_state.exs new file mode 100644 index 00000000..33b51681 --- /dev/null +++ b/priv/repo/migrations/20260327231100_add_suspended_to_oban_job_state.exs @@ -0,0 +1,19 @@ +defmodule Towerops.Repo.Migrations.AddSuspendedToObanJobState do + use Ecto.Migration + + @disable_ddl_transaction true + + def up do + # Add 'suspended' state to oban_job_state enum + # This state was added in Oban 2.18+ and is required by Oban.Met + execute """ + ALTER TYPE oban_job_state ADD VALUE IF NOT EXISTS 'suspended' + """ + end + + def down do + # Cannot remove enum values in PostgreSQL without recreating the type + # This is a one-way migration + :ok + end +end