"""Add video fingerprint and duplicate detection fields to generated_videos table.

Revision ID: 008
Revises: 007
Create Date: 2024-06-26
"""

import sqlalchemy as sa

from alembic import op

revision = "008"
down_revision = "007"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # Add video_fingerprint column as JSON text
    op.add_column("generated_videos", sa.Column("video_fingerprint", sa.Text(), nullable=True))
    # Add is_duplicate column
    op.add_column("generated_videos", sa.Column("is_duplicate", sa.Boolean(), nullable=False, server_default="false"))
    # Add duplicate_of column for tracking original video
    op.add_column("generated_videos", sa.Column("duplicate_of", sa.String(32), nullable=True))


def downgrade() -> None:
    op.drop_column("generated_videos", "duplicate_of")
    op.drop_column("generated_videos", "is_duplicate")
    op.drop_column("generated_videos", "video_fingerprint")
