"""add generation task extensions

Revision ID: 015
Revises: 014
Create Date: 2026-06-29
"""

import sqlalchemy as sa
from sqlalchemy.dialects import mysql

from alembic import op

# revision identifiers
revision = "015"
down_revision = "014"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column("generation_tasks", sa.Column("template_id", sa.String(36), nullable=False, server_default=""))
    op.add_column("generation_tasks", sa.Column("asset_ids", mysql.JSON(), nullable=False, server_default="[]"))
    op.add_column("generation_tasks", sa.Column("title_ids", mysql.JSON(), nullable=False, server_default="[]"))
    op.add_column("generation_tasks", sa.Column("voice_ids", mysql.JSON(), nullable=False, server_default="[]"))

    op.create_index(op.f("ix_generation_tasks_template_id"), "generation_tasks", ["template_id"])


def downgrade() -> None:
    op.drop_index(op.f("ix_generation_tasks_template_id"), table_name="generation_tasks")
    op.drop_column("generation_tasks", "voice_ids")
    op.drop_column("generation_tasks", "title_ids")
    op.drop_column("generation_tasks", "asset_ids")
    op.drop_column("generation_tasks", "template_id")
