From cf0a08f5034de912098df82695f3c3da11f176ee Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 2 Oct 2026 12:08:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(viral-video):=20=E8=A1=A5=20current=5Fstage?= =?UTF-8?q?=20=E5=88=97=E8=BF=81=E7=A7=BB=EF=BC=8C=E4=BF=AE=E5=A4=8D=20sta?= =?UTF-8?q?ging=20500=20(#2137)=20(#2138)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alembic/versions/091_viral_video_stage.py | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 alembic/versions/091_viral_video_stage.py diff --git a/alembic/versions/091_viral_video_stage.py b/alembic/versions/091_viral_video_stage.py new file mode 100644 index 000000000..3a7e74b25 --- /dev/null +++ b/alembic/versions/091_viral_video_stage.py @@ -0,0 +1,49 @@ +"""viral video add current_stage column (#2137 follow-up) + +Revision ID: 091_viral_video_stage +Revises: 090_viral_video_phase_msg +Create Date: 2026-10-02 + +#2137 follow-up fix: 090 migration missed current_stage column on viral_video_jobs, +causing UndefinedColumn errors and 500s on all authenticated viral-video endpoints. +Idempotently add current_stage and double-check phase_message. +""" + +import sqlalchemy as sa + +from alembic import op + +revision = "091_viral_video_stage" +down_revision = "090_viral_video_phase_msg" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + conn = op.get_bind() + inspector = sa.inspect(conn) + cols = {c["name"] for c in inspector.get_columns("viral_video_jobs")} + if "current_stage" not in cols: + op.add_column( + "viral_video_jobs", + sa.Column( + "current_stage", + sa.String(length=200), + nullable=False, + server_default="", + ), + ) + if "phase_message" not in cols: + op.add_column( + "viral_video_jobs", + sa.Column( + "phase_message", + sa.String(length=500), + nullable=False, + server_default="", + ), + ) + + +def downgrade() -> None: + op.drop_column("viral_video_jobs", "current_stage")