"""add player_positions to roster_links

Revision ID: 006
Revises: 62bd3195c64c
Create Date: 2026-01-17

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSONB


# revision identifiers, used by Alembic.
revision: str = '006'
down_revision: Union[str, None] = '62bd3195c64c'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # Add player_positions column for storing player's natural positions
    # This allows the frontend to filter bench players by position type (batters vs pitchers)
    # Example values: ["SS", "2B", "3B"] or ["SP", "RP"] or ["SP", "DH"] (two-way player)
    op.add_column(
        'roster_links',
        sa.Column('player_positions', JSONB, nullable=True, server_default='[]')
    )


def downgrade() -> None:
    op.drop_column('roster_links', 'player_positions')
