"""add continuous evals table

Revision ID: 714d70516fae
Revises: 8a2f6f0802a3
Create Date: 2025-12-03 17:09:27.681183

"""

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "714d70516fae"
down_revision = "8a2f6f0802a3"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "continuous_evals",
        sa.Column("id", sa.UUID(), nullable=False),
        sa.Column("name", sa.String(), nullable=False),
        sa.Column("description", sa.String(), nullable=True),
        sa.Column("task_id", sa.String(), nullable=False),
        sa.Column("llm_eval_name", sa.String(), nullable=False),
        sa.Column("llm_eval_version", sa.Integer(), nullable=False),
        sa.Column("transform_id", sa.UUID(), nullable=False),
        sa.Column("created_at", sa.TIMESTAMP(), nullable=False),
        sa.Column("updated_at", sa.TIMESTAMP(), nullable=False),
        sa.ForeignKeyConstraint(
            ["task_id", "llm_eval_name", "llm_eval_version"],
            ["llm_evals.task_id", "llm_evals.name", "llm_evals.version"],
            name="fk_llm_eval_transforms_eval",
            ondelete="CASCADE",
        ),
        sa.ForeignKeyConstraint(
            ["transform_id"],
            ["trace_transforms.id"],
            ondelete="CASCADE",
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("continuous_evals")
    # ### end Alembic commands ###
