- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck - Google OAuth (single allowed account), encrypted refresh token storage - Subscriptions sync with pagination, uploads playlist batch fetch - Categories CRUD, many-to-many channel assignment, category filtering - Video sync (playlistItems + videos.list batching), cached feed with cursor pagination, background scheduler (APScheduler) - Video detail page with YouTube embed player - SPA fallback routing, optimistic UI updates, client-side query caching 40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes, cursor pagination, and category filtering. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
44 lines
1.8 KiB
Python
44 lines
1.8 KiB
Python
"""videos
|
|
|
|
Revision ID: 0004_videos
|
|
Revises: 0003_categories
|
|
Create Date: 2026-09-16
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision: str = "0004_videos"
|
|
down_revision: Union[str, None] = "0003_categories"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"videos",
|
|
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
|
|
sa.Column("youtube_video_id", sa.String(length=32), nullable=False),
|
|
sa.Column("channel_id", sa.Integer(), sa.ForeignKey("channels.id"), nullable=False),
|
|
sa.Column("title", sa.String(length=500), nullable=False),
|
|
sa.Column("description", sa.Text(), nullable=True),
|
|
sa.Column("thumbnail_url", sa.String(), nullable=True),
|
|
sa.Column("published_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column("duration_seconds", sa.Integer(), nullable=True),
|
|
sa.Column("youtube_url", sa.String(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
sa.UniqueConstraint("youtube_video_id", name="uq_videos_youtube_video_id"),
|
|
)
|
|
op.create_index("ix_videos_youtube_video_id", "videos", ["youtube_video_id"])
|
|
op.create_index("ix_videos_channel_id", "videos", ["channel_id"])
|
|
op.create_index("ix_videos_published_at", "videos", ["published_at"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_videos_published_at", table_name="videos")
|
|
op.drop_index("ix_videos_channel_id", table_name="videos")
|
|
op.drop_index("ix_videos_youtube_video_id", table_name="videos")
|
|
op.drop_table("videos")
|