siftlode/backend/alembic/versions/0019_user_yt_channel_id.py

29 lines
905 B
Python
Raw Normal View History

"""cache each user's own YouTube channel id
Revision ID: 0019_user_yt_channel_id
Revises: 0018_maintenance_batch_setting
Create Date: 2026-06-19
Adds users.yt_channel_id: the user's own YouTube channel id, resolved lazily from
channels.list?mine=true and cached. Used to exclude the user's own channel from the
playlist-discovery list (you don't subscribe to yourself). NULL = not resolved yet.
Purely additive.
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "0019_user_yt_channel_id"
down_revision: Union[str, None] = "0018_maintenance_batch_setting"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column("users", sa.Column("yt_channel_id", sa.String(length=32), nullable=True))
def downgrade() -> None:
op.drop_column("users", "yt_channel_id")