"""ai_avatar_render_jobs.script_id 放宽为可空串(手动文案直生场景不关联文案库) Revision ID: 074_render_script_id_optional Revises: 073_add_lipsync_tts_fields Create Date: 2026-09-09 """ import sqlalchemy as sa from alembic import op revision = "074_render_script_id_optional" down_revision = "073_add_lipsync_tts_fields" branch_labels = None depends_on = None def upgrade() -> None: # 列保持 NOT NULL(空串占位),仅应用层允许不传;这里显式补 server_default 防止历史约束歧义 with op.batch_alter_table("ai_avatar_render_jobs") as batch: batch.alter_column( "script_id", existing_type=sa.String(length=36), nullable=False, server_default="", ) def downgrade() -> None: with op.batch_alter_table("ai_avatar_render_jobs") as batch: batch.alter_column( "script_id", existing_type=sa.String(length=36), nullable=False, server_default=None, )