"""favorite_performers — ulubione performerki (single-user, in-app)

Revision ID: 0005_favorite_performers
Revises: 0004_animated_thumbnail
Create Date: 2026-05-04

Single-user system (brak users), więc tabelka to po prostu zbiór performer_id które
user oznaczył jako ulubione, plus `last_seen_at` żeby mobile mogło policzyć ile nowych
scen pojawiło się od ostatniego oglądania (badge w toolbar/Favorites screen).

Multi-user można dodać potem (kolumna user_id + composite PK), bez breaking change.
"""
from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

revision: str = "0005_favorite_performers"
down_revision: str | None = "0004_animated_thumbnail"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    op.create_table(
        "favorite_performers",
        sa.Column("performer_id", sa.dialects.postgresql.UUID(as_uuid=True),
                  sa.ForeignKey("performers.id", ondelete="CASCADE"),
                  primary_key=True),
        sa.Column("created_at", sa.DateTime(timezone=True),
                  server_default=sa.func.now(), nullable=False),
        sa.Column("last_seen_at", sa.DateTime(timezone=True),
                  server_default=sa.func.now(), nullable=False),
    )


def downgrade() -> None:
    op.drop_table("favorite_performers")
