"""Fixed key modelset index

Peek Plugin Database Migration Script

Revision ID: ab9da4532175
Revises: b0b08aff8542
Create Date: 2017-07-16 13:38:20.517763

"""

# revision identifiers, used by Alembic.
revision = "ab9da4532175"
down_revision = "b0b08aff8542"
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
import geoalchemy2


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(
        "idx_LiveDbDKey_modelSet_key",
        "LiveDbItem",
        ["modelSetId", "key"],
        unique=True,
        schema="pl_livedb",
    )
    op.drop_index(
        "idx_LiveDbDKey_liveDbKey", table_name="LiveDbItem", schema="pl_livedb"
    )
    op.drop_index(
        "idx_LiveDbDKey_modelSetId", table_name="LiveDbItem", schema="pl_livedb"
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(
        "idx_LiveDbDKey_modelSetId",
        "LiveDbItem",
        ["modelSetId"],
        unique=False,
        schema="pl_livedb",
    )
    op.create_index(
        "idx_LiveDbDKey_liveDbKey",
        "LiveDbItem",
        ["key"],
        unique=False,
        schema="pl_livedb",
    )
    op.drop_index(
        "idx_LiveDbDKey_modelSet_key", table_name="LiveDbItem", schema="pl_livedb"
    )
    # ### end Alembic commands ###
