"""Add player_data JSONB column to roster_links for caching player names/images.

Revision ID: 007
Revises: 006
Create Date: 2026-01-17

This stores player name, image, and headshot at lineup submission time,
eliminating the need for runtime API calls when loading bench players.
"""

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


# revision identifiers, used by Alembic.
revision = "007"
down_revision = "006"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column(
        "roster_links",
        sa.Column("player_data", JSONB, nullable=True, server_default="{}")
    )


def downgrade() -> None:
    op.drop_column("roster_links", "player_data")
