"""Add feedback table

Revision ID: 769fc709b3a7
Revises: ae3165cd8947
Create Date: 2023-08-23 09:39:28.434690

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "769fc709b3a7"
down_revision = "ae3165cd8947"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "inference_feedback",
        sa.Column("id", sa.String(), nullable=False),
        sa.Column("inference_id", sa.String(), nullable=False),
        sa.Column("target", sa.String(), nullable=False),
        sa.Column("score", sa.Integer(), nullable=False),
        sa.Column("reason", sa.String(), nullable=True),
        sa.ForeignKeyConstraint(
            ["inference_id"],
            ["inferences.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        op.f("ix_inference_feedback_inference_id"),
        "inference_feedback",
        ["inference_id"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(
        op.f("ix_inference_feedback_inference_id"),
        table_name="inference_feedback",
    )
    op.drop_table("inference_feedback")
    # ### end Alembic commands ###
