"""rename style_preset to style_id

Revision ID: rename_style_preset
Revises: add_cinematic_fields, add_provider_to_tasks
Create Date: 2024-02-11

"""
from alembic import op
import sqlalchemy as sa
from typing import Union, Sequence


# revision identifiers, used by Alembic.
revision = 'rename_style_preset'
down_revision: Union[str, Sequence[str], None] = ('add_cinematic_fields', 'add_provider_to_tasks')
branch_labels = None
depends_on = None


def upgrade():
    """Rename style_preset column to style_id in projects table"""
    # SQLite doesn't support ALTER COLUMN RENAME directly
    # We need to use a workaround with table recreation
    
    with op.batch_alter_table('projects', schema=None) as batch_op:
        # Rename the column
        batch_op.alter_column('style_preset', new_column_name='style_id')


def downgrade():
    """Revert style_id column back to style_preset"""
    with op.batch_alter_table('projects', schema=None) as batch_op:
        # Rename back
        batch_op.alter_column('style_id', new_column_name='style_preset')
