"""add_speaker_fields_to_segments

Revision ID: c7d4e9f3a2b1
Revises: b5c3e8a2d1f0
Create Date: 2025-12-18 16:00:00.000000

"""

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

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


def upgrade() -> None:
    """Add speaker_id and speaker_confidence columns to segments table."""
    op.add_column(
        "segments",
        sa.Column("speaker_id", sa.String(50), nullable=True),
        schema="noteflow",
    )
    op.add_column(
        "segments",
        sa.Column("speaker_confidence", sa.Float(), nullable=False, server_default="0.0"),
        schema="noteflow",
    )


def downgrade() -> None:
    """Remove speaker_id and speaker_confidence columns from segments table."""
    op.drop_column("segments", "speaker_confidence", schema="noteflow")
    op.drop_column("segments", "speaker_id", schema="noteflow")
