"""Add skip tracking columns to play_history

Revision ID: a1b2c3d4e5f6
Revises: f92d8a9264d3
Create Date: 2025-12-29 22:30:00.000000

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "a1b2c3d4e5f6"
down_revision: Union[str, Sequence[str], None] = "f92d8a9264d3"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Add listened_ms, skipped, and source columns to play_history."""
    op.add_column("play_history", sa.Column("listened_ms", sa.Integer(), nullable=True))
    op.add_column("play_history", sa.Column("skipped", sa.Boolean(), nullable=True))
    op.add_column("play_history", sa.Column("source", sa.String(), nullable=True))
    # source can be: 'recently_played', 'currently_playing', 'inferred'


def downgrade() -> None:
    """Remove skip tracking columns."""
    op.drop_column("play_history", "source")
    op.drop_column("play_history", "skipped")
    op.drop_column("play_history", "listened_ms")
