"""Add batch_id to generation_tasks

Revision ID: 033
Revises: 032
Create Date: 2026-07-07

视频查重功能：为 generation_tasks 表添加 batch_id 字段，
用于关联同一次批量生成请求中的多个任务。
"""

import sqlalchemy as sa

from alembic import op

revision = "033"
down_revision = "032"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column(
        "generation_tasks",
        sa.Column("batch_id", sa.String(32), nullable=False, server_default=""),
    )
    op.create_index(op.f("ix_generation_tasks_batch_id"), "generation_tasks", ["batch_id"])


def downgrade() -> None:
    op.drop_index(op.f("ix_generation_tasks_batch_id"), table_name="generation_tasks")
    op.drop_column("generation_tasks", "batch_id")
