"""Adding UEI indexes to FPDS, FABS, and FSRS tables

Revision ID: e26d14b0d235
Revises: e7c6490c904a
Create Date: 2021-11-05 16:01:33.112510

"""

# revision identifiers, used by Alembic.
revision = 'e26d14b0d235'
down_revision = 'e7c6490c904a'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(op.f('ix_detached_award_procurement_ultimate_parent_uei'), 'detached_award_procurement', ['ultimate_parent_uei'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_ultimate_parent_unique_ide'), 'detached_award_procurement', ['ultimate_parent_unique_ide'], unique=False)
    op.create_index(op.f('ix_fsrs_grant_duns'), 'fsrs_grant', ['duns'], unique=False)
    op.create_index(op.f('ix_fsrs_grant_parent_duns'), 'fsrs_grant', ['parent_duns'], unique=False)
    op.create_index(op.f('ix_fsrs_grant_parent_uei'), 'fsrs_grant', ['parent_uei'], unique=False)
    op.create_index(op.f('ix_fsrs_grant_uei_number'), 'fsrs_grant', ['uei_number'], unique=False)
    op.create_index(op.f('ix_fsrs_procurement_duns'), 'fsrs_procurement', ['duns'], unique=False)
    op.create_index(op.f('ix_fsrs_procurement_parent_duns'), 'fsrs_procurement', ['parent_duns'], unique=False)
    op.create_index(op.f('ix_fsrs_procurement_parent_uei'), 'fsrs_procurement', ['parent_uei'], unique=False)
    op.create_index(op.f('ix_fsrs_procurement_uei_number'), 'fsrs_procurement', ['uei_number'], unique=False)
    op.create_index(op.f('ix_fsrs_subcontract_duns'), 'fsrs_subcontract', ['duns'], unique=False)
    op.create_index(op.f('ix_fsrs_subcontract_parent_duns'), 'fsrs_subcontract', ['parent_duns'], unique=False)
    op.create_index(op.f('ix_fsrs_subcontract_parent_uei'), 'fsrs_subcontract', ['parent_uei'], unique=False)
    op.create_index(op.f('ix_fsrs_subcontract_uei_number'), 'fsrs_subcontract', ['uei_number'], unique=False)
    op.create_index(op.f('ix_fsrs_subgrant_duns'), 'fsrs_subgrant', ['duns'], unique=False)
    op.create_index(op.f('ix_fsrs_subgrant_parent_duns'), 'fsrs_subgrant', ['parent_duns'], unique=False)
    op.create_index(op.f('ix_fsrs_subgrant_parent_uei'), 'fsrs_subgrant', ['parent_uei'], unique=False)
    op.create_index(op.f('ix_fsrs_subgrant_uei_number'), 'fsrs_subgrant', ['uei_number'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_ultimate_parent_unique_ide'), 'published_award_financial_assistance', ['ultimate_parent_unique_ide'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_ultimate_parent_uei'), 'published_award_financial_assistance', ['ultimate_parent_uei'], unique=False)
    # ### end Alembic commands ###


def downgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_published_award_financial_assistance_ultimate_parent_uei'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_ultimate_parent_unique_ide'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_fsrs_subgrant_uei_number'), table_name='fsrs_subgrant')
    op.drop_index(op.f('ix_fsrs_subgrant_parent_uei'), table_name='fsrs_subgrant')
    op.drop_index(op.f('ix_fsrs_subgrant_parent_duns'), table_name='fsrs_subgrant')
    op.drop_index(op.f('ix_fsrs_subgrant_duns'), table_name='fsrs_subgrant')
    op.drop_index(op.f('ix_fsrs_subcontract_uei_number'), table_name='fsrs_subcontract')
    op.drop_index(op.f('ix_fsrs_subcontract_parent_uei'), table_name='fsrs_subcontract')
    op.drop_index(op.f('ix_fsrs_subcontract_parent_duns'), table_name='fsrs_subcontract')
    op.drop_index(op.f('ix_fsrs_subcontract_duns'), table_name='fsrs_subcontract')
    op.drop_index(op.f('ix_fsrs_procurement_uei_number'), table_name='fsrs_procurement')
    op.drop_index(op.f('ix_fsrs_procurement_parent_uei'), table_name='fsrs_procurement')
    op.drop_index(op.f('ix_fsrs_procurement_parent_duns'), table_name='fsrs_procurement')
    op.drop_index(op.f('ix_fsrs_procurement_duns'), table_name='fsrs_procurement')
    op.drop_index(op.f('ix_fsrs_grant_uei_number'), table_name='fsrs_grant')
    op.drop_index(op.f('ix_fsrs_grant_parent_uei'), table_name='fsrs_grant')
    op.drop_index(op.f('ix_fsrs_grant_parent_duns'), table_name='fsrs_grant')
    op.drop_index(op.f('ix_fsrs_grant_duns'), table_name='fsrs_grant')
    op.drop_index(op.f('ix_detached_award_procurement_ultimate_parent_unique_ide'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_procurement_ultimate_parent_uei'), table_name='detached_award_procurement')
    # ### end Alembic commands ###

