From 1f1d513437ad42d9d93f7709f2ba795d57d70e2a Mon Sep 17 00:00:00 2001 From: Eric Lammertsma Date: Thu, 29 Jan 2026 15:16:08 -0500 Subject: [PATCH] fix(database): handle duplicate podcast_status type creation gracefully Modify the upgrade function to prevent errors when creating the podcast_status ENUM type by wrapping the creation in a DO block that catches duplicate_object exceptions. --- .../alembic/versions/82_add_podcast_status_and_thread.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/surfsense_backend/alembic/versions/82_add_podcast_status_and_thread.py b/surfsense_backend/alembic/versions/82_add_podcast_status_and_thread.py index fd4eed89f..46e39fa3b 100644 --- a/surfsense_backend/alembic/versions/82_add_podcast_status_and_thread.py +++ b/surfsense_backend/alembic/versions/82_add_podcast_status_and_thread.py @@ -20,7 +20,11 @@ depends_on: str | Sequence[str] | None = None def upgrade() -> None: op.execute( """ - CREATE TYPE podcast_status AS ENUM ('pending', 'generating', 'ready', 'failed'); + DO $$ BEGIN + CREATE TYPE podcast_status AS ENUM ('pending', 'generating', 'ready', 'failed'); + EXCEPTION + WHEN duplicate_object THEN null; + END $$; """ )