"""Add annotationqueue table

Revision ID: 29b9d199322a
Revises: a676aa29c936
Create Date: 2021-11-11 15:31:36.687953

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "29b9d199322a"
down_revision = "a676aa29c936"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "annotationqueue",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("sample_id", sa.String(), nullable=False),
        sa.Column("queue_name", sa.String(), nullable=False),
        sa.Column("requested_by", sa.String(), nullable=True),
        sa.Column("created", sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(
            ["sample_id"],
            ["samples.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        op.f("ix_annotationqueue_id"), "annotationqueue", ["id"], unique=False
    )
    op.create_index(
        op.f("ix_annotationqueue_requested_by"),
        "annotationqueue",
        ["requested_by"],
        unique=False,
    )
    op.create_index(
        op.f("ix_annotationqueue_sample_id"),
        "annotationqueue",
        ["sample_id"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_annotationqueue_sample_id"), table_name="annotationqueue")
    op.drop_index(op.f("ix_annotationqueue_requested_by"), table_name="annotationqueue")
    op.drop_index(op.f("ix_annotationqueue_id"), table_name="annotationqueue")
    op.drop_table("annotationqueue")
    # ### end Alembic commands ###
