"""add_diarization_job_fields

Revision ID: j4e5f6g7h8i9
Revises: i3d4e5f6g7h8
Create Date: 2025-12-25 14:00:00.000000

"""

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "j4e5f6g7h8i9"
down_revision: str | Sequence[str] | None = "i3d4e5f6g7h8"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    """Add audio_duration_seconds and started_at to diarization_jobs."""
    op.add_column(
        "diarization_jobs",
        sa.Column("audio_duration_seconds", sa.Float(), nullable=True),
        schema="noteflow",
    )
    op.add_column(
        "diarization_jobs",
        sa.Column("started_at", sa.DateTime(timezone=True), nullable=True),
        schema="noteflow",
    )


def downgrade() -> None:
    """Remove audio_duration_seconds and started_at."""
    op.drop_column("diarization_jobs", "started_at", schema="noteflow")
    op.drop_column("diarization_jobs", "audio_duration_seconds", schema="noteflow")
