"""empty message

Revision ID: e7b581c2023e
Revises: c084d6b8252e
Create Date: 2020-02-10 18:11:46.984801

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "e7b581c2023e"
down_revision = "c084d6b8252e"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(
        "clients_id_btree_is_agency_true",
        "clients",
        ["id"],
        unique=False,
        postgresql_where=sa.text("is_agency IS true"),
    )
    op.create_index(
        "contracts_client_id_btree_ind", "contracts", ["client_id"], unique=False
    )
    op.drop_index("contracts_external_id_hash_ind", table_name="contracts")
    op.create_index(
        "orders_agency_id_client_id_btree_ind",
        "orders",
        ["agency_id", "client_id"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index("orders_agency_id_client_id_btree_ind", table_name="orders")
    op.create_index(
        "contracts_external_id_hash_ind", "contracts", ["external_id"], unique=False
    )
    op.drop_index("contracts_client_id_btree_ind", table_name="contracts")
    op.drop_index("clients_id_btree_is_agency_true", table_name="clients")
    # ### end Alembic commands ###
