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.
This commit is contained in:
Eric Lammertsma 2026-01-29 15:16:08 -05:00
parent 0b65c3a98c
commit 1f1d513437

View file

@ -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 $$;
"""
)