"""Add LabelPatterns

Revision ID: 779682965b20
Revises: <PASSWORD>
Create Date: 2020-05-13 14:33:35.755820

"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "779682965b20"
down_revision = "<PASSWORD>"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "label_patterns",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("label", sa.String(), nullable=False),
        sa.Column("data", sa.JSON(), nullable=True),
        sa.PrimaryKeyConstraint("id", name=op.f("pk_label_patterns")),
    )
    with op.batch_alter_table("label_patterns", schema=None) as batch_op:
        batch_op.create_index(
            batch_op.f("ix_label_patterns_label"), ["label"], unique=True
        )

    with op.batch_alter_table("annotation_guide", schema=None) as batch_op:
        batch_op.drop_index("ix_annotation_guide_label")
        batch_op.create_index(
            batch_op.f("ix_annotation_guide_label"), ["label"], unique=True
        )

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("annotation_guide", schema=None) as batch_op:
        batch_op.drop_index(batch_op.f("ix_annotation_guide_label"))
        batch_op.create_index("ix_annotation_guide_label", ["label"], unique=False)

    with op.batch_alter_table("label_patterns", schema=None) as batch_op:
        batch_op.drop_index(batch_op.f("ix_label_patterns_label"))

    op.drop_table("label_patterns")
    # ### end Alembic commands ###

"""Add LabelPatterns

Revision ID: 779682965b20
Revises: <PASSWORD>
Create Date: 2020-05-13 14:33:35.755820

"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "779682965b20"
down_revision = "<PASSWORD>"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "label_patterns",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("label", sa.String(), nullable=False),
        sa.Column("data", sa.JSON(), nullable=True),
        sa.PrimaryKeyConstraint("id", name=op.f("pk_label_patterns")),
    )
    with op.batch_alter_table("label_patterns", schema=None) as batch_op:
        batch_op.create_index(
            batch_op.f("ix_label_patterns_label"), ["label"], unique=True
        )

    with op.batch_alter_table("annotation_guide", schema=None) as batch_op:
        batch_op.drop_index("ix_annotation_guide_label")
        batch_op.create_index(
            batch_op.f("ix_annotation_guide_label"), ["label"], unique=True
        )

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("annotation_guide", schema=None) as batch_op:
        batch_op.drop_index(batch_op.f("ix_annotation_guide_label"))
        batch_op.create_index("ix_annotation_guide_label", ["label"], unique=False)

    with op.batch_alter_table("label_patterns", schema=None) as batch_op:
        batch_op.drop_index(batch_op.f("ix_label_patterns_label"))

    op.drop_table("label_patterns")
    # ### end Alembic commands ###

Add LabelPatterns  Revision ID: 779682965b20 Revises: <PASSWORD> Create Date: 2020-05-13 14:33:35.755820 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###