"""add cinematic and professional fields to assets and storyboards

Revision ID: add_cinematic_fields
Revises: add_prompt_fields
Create Date: 2026-01-20

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'add_cinematic_fields'
down_revision = 'add_canvas_metadata'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # Assets表已经使用extra_data存储这些字段，但为了查询效率，我们可以选择不添加直接列
    # 因为Asset的emotion, environment_type, weather等字段已经通过extra_data JSON存储
    # 如果未来需要索引查询，可以添加：
    # op.add_column('assets', sa.Column('emotion', sa.String(), nullable=True))
    # op.add_column('assets', sa.Column('environment_type', sa.String(), nullable=True))
    # op.add_column('assets', sa.Column('weather', sa.String(), nullable=True))
    
    # Add cinematic control fields to storyboards table
    op.add_column('storyboards', sa.Column('camera_angle', sa.String(), nullable=True))
    op.add_column('storyboards', sa.Column('lens', sa.String(), nullable=True))
    op.add_column('storyboards', sa.Column('focus', sa.String(), nullable=True))
    op.add_column('storyboards', sa.Column('lighting', sa.String(), nullable=True))
    op.add_column('storyboards', sa.Column('color_style', sa.String(), nullable=True))


def downgrade() -> None:
    # Remove cinematic fields from storyboards
    op.drop_column('storyboards', 'color_style')
    op.drop_column('storyboards', 'lighting')
    op.drop_column('storyboards', 'focus')
    op.drop_column('storyboards', 'lens')
    op.drop_column('storyboards', 'camera_angle')
