"""add schedule_game_id to games

Revision ID: 62bd3195c64c
Revises: 005
Create Date: 2026-01-14 23:44:40.038088

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


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


def upgrade() -> None:
    # Add schedule_game_id column for linking webapp games to external schedule systems
    op.add_column(
        'games',
        sa.Column('schedule_game_id', sa.Integer(), nullable=True)
    )
    # Add index for efficient lookups
    op.create_index(
        'ix_games_schedule_game_id',
        'games',
        ['schedule_game_id']
    )


def downgrade() -> None:
    op.drop_index('ix_games_schedule_game_id', table_name='games')
    op.drop_column('games', 'schedule_game_id')
