"""favorite_studios — ulubione studia (single-user, in-app)

Revision ID: 0012_favorite_studios
Revises: 0011_origin_pornapp_to_tube
Create Date: 2026-05-08

Mirror `favorite_performers` ze studio_id zamiast performer_id. Single-user, więc
tabelka to po prostu zbiór studio_id które user oznaczył jako ulubione, plus
`last_seen_at` — mobile liczy ile nowych scen pojawiło się w danym studio od
ostatniego oglądania (badge w Favorites).
"""
from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

revision: str = "0012_favorite_studios"
down_revision: str | None = "0011_origin_pornapp_to_tube"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    op.create_table(
        "favorite_studios",
        sa.Column(
            "studio_id",
            sa.dialects.postgresql.UUID(as_uuid=True),
            sa.ForeignKey("studios.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_studios")
