goon/alembic/versions/20260510_0015_bug_reports_movie_id.py
goon-foss ad0284585b Initial commit
Goon — self-hosted aggregator for adult-content scene metadata.

Indexes scenes from TPDB, StashDB, and 30+ public adult tube sites.
Cross-source deduplication via perceptual hash + Levenshtein distance.
FastAPI backend + APScheduler worker + React Native (Expo) mobile client.

FOSS, ad-free, donation-funded. See README for details.
2026-05-20 10:10:22 +02:00

38 lines
1.1 KiB
Python

"""bug_reports — dodaj movie_id (FK movies, nullable)
Revision ID: 0015_bug_reports_movie_id
Revises: 0014_favorite_movies
Create Date: 2026-05-10
Mobile Player przekazuje movie_id w nav params jako `sceneId` (legacy hack na
progress tracking, który dla movies zwraca 404 i mobile to ignoruje). Bug-report
flow inserted to przy POST jako scene_id, FK violation crash → 500.
Fix: rozszerz tabelę o movie_id, backend smart-routes po lookup (jeśli scene_id
nie istnieje w scenes ALE istnieje w movies, zapisz jako movie_id).
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "0015_bug_reports_movie_id"
down_revision: str | None = "0014_favorite_movies"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
op.add_column(
"bug_reports",
sa.Column(
"movie_id",
sa.dialects.postgresql.UUID(as_uuid=True),
sa.ForeignKey("movies.id", ondelete="SET NULL"),
nullable=True,
),
)
def downgrade() -> None:
op.drop_column("bug_reports", "movie_id")