"""add need_product_image to generation_tasks

Revision ID: 007
Revises: 006
Create Date: 2026-06-08

本次产品是否入镜开关：True=必须产品参考图(无图禁生成,不降级)，False=允许纯文生图。
默认 True（铁律：生图优先带产品参考图）。
"""
from alembic import op
import sqlalchemy as sa

revision = "007"
down_revision = "006"
branch_labels = None
depends_on = None


def upgrade():
    op.add_column(
        "generation_tasks",
        sa.Column(
            "need_product_image",
            sa.Boolean(),
            nullable=False,
            server_default=sa.true(),
            comment="本次产品是否入镜:True需产品图(无图禁生成不降级)/False允许纯文生图",
        ),
    )


def downgrade():
    op.drop_column("generation_tasks", "need_product_image")
