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: graham/towerops-web#199
This commit is contained in:
Graham McIntire 2026-03-27 18:14:20 -05:00 committed by graham
parent bf30d9ec7e
commit b902480361
2 changed files with 28 additions and 0 deletions

View file

@ -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

View file

@ -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