"""Add toxicity score table

Revision ID: 2d71226b9961
Revises: 083f1ae171fd
Create Date: 2023-11-08 13:02:17.412889

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "2d71226b9961"
down_revision = "083f1ae171fd"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "toxicity_scores",
        sa.Column("id", sa.String(), nullable=False),
        sa.Column("rule_result_detail_id", sa.String(), nullable=False),
        sa.Column("toxicity_score", sa.Float(), nullable=False),
        sa.ForeignKeyConstraint(
            ["rule_result_detail_id"],
            ["rule_result_details.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        op.f("ix_toxicity_scores_id"),
        "toxicity_scores",
        ["id"],
        unique=False,
    )
    # ### end Alembic commands ###


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