"""local poster path for thumbnail-less downloads

Revision ID: 0050_asset_poster
Revises: 0049_download_display_meta
Create Date: 2026-07-07

Some sources (a direct media URL like a reddit v.redd.it HLS manifest) carry no thumbnail, so the
download shows a blank image box. The worker now extracts a representative frame with ffmpeg and
saves it as a poster sidecar; `poster_path` (relative to download_root) records it so the card /
watch page / link preview can fall back to it. Nullable — only set when there was no thumbnail.
"""
from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

revision: str = "0050_asset_poster"
down_revision: Union[str, None] = "0049_download_display_meta"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column("media_assets", sa.Column("poster_path", sa.Text(), nullable=True))


def downgrade() -> None:
    op.drop_column("media_assets", "poster_path")
