"""Add actual_winner column to matches table

Revision ID: 0006
Revises: 0005
Create Date: 2026-01-17 00:00:00.000000

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0006'
down_revision = '0005'
branch_labels = None
depends_on = None


def upgrade() -> None:
    """Add actual_winner column to matches table."""
    op.add_column(
        'matches',
        sa.Column(
            'actual_winner',
            sa.String(255),
            nullable=True,
            comment='Actual winner of the match: home, away, or draw'
        )
    )
    # Create index for faster queries
    op.create_index(
        'ix_matches_actual_winner',
        'matches',
        ['actual_winner']
    )


def downgrade() -> None:
    """Remove actual_winner column from matches table."""
    op.drop_index('ix_matches_actual_winner', table_name='matches')
    op.drop_column('matches', 'actual_winner')
