"""add indexing to staging models

Revision ID: 4b1ee78268fb
Revises: 6877b5657ffc
Create Date: 2017-08-28 11:13:12.232385

"""

# revision identifiers, used by Alembic.
revision = '4b1ee78268fb'
down_revision = '6877b5657ffc'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


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.drop_index('ix_published_award_financial_assistance_correction_late_fa61', table_name='published_award_financial_assistance')
    op.create_index(op.f('ix_appropriation_row_number'), 'appropriation', ['row_number'], unique=False)
    op.create_index(op.f('ix_appropriation_tas_id'), 'appropriation', ['tas_id'], unique=False)
    op.create_index(op.f('ix_award_financial_agency_identifier'), 'award_financial', ['agency_identifier'], unique=False)
    op.create_index(op.f('ix_award_financial_allocation_transfer_agency'), 'award_financial', ['allocation_transfer_agency'], unique=False)
    op.create_index(op.f('ix_award_financial_main_account_code'), 'award_financial', ['main_account_code'], unique=False)
    op.create_index(op.f('ix_award_financial_object_class'), 'award_financial', ['object_class'], unique=False)
    op.create_index(op.f('ix_award_financial_parent_award_id'), 'award_financial', ['parent_award_id'], unique=False)
    op.create_index(op.f('ix_award_financial_program_activity_code'), 'award_financial', ['program_activity_code'], unique=False)
    op.create_index(op.f('ix_award_financial_row_number'), 'award_financial', ['row_number'], unique=False)
    op.create_index(op.f('ix_award_financial_tas'), 'award_financial', ['tas'], unique=False)
    op.create_index(op.f('ix_award_financial_tas_id'), 'award_financial', ['tas_id'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_action_date'), 'award_financial_assistance', ['action_date'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_action_type'), 'award_financial_assistance', ['action_type'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_assistance_type'), 'award_financial_assistance', ['assistance_type'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_awardee_or_recipient_uniqu'), 'award_financial_assistance', ['awardee_or_recipient_uniqu'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_awarding_agency_code'), 'award_financial_assistance', ['awarding_agency_code'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_awarding_sub_tier_agency_c'), 'award_financial_assistance', ['awarding_sub_tier_agency_c'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_cfda_number'), 'award_financial_assistance', ['cfda_number'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_correction_late_delete_ind'), 'award_financial_assistance', ['correction_late_delete_ind'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_federal_action_obligation'), 'award_financial_assistance', ['federal_action_obligation'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_funding_agency_code'), 'award_financial_assistance', ['funding_agency_code'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_funding_sub_tier_agency_co'), 'award_financial_assistance', ['funding_sub_tier_agency_co'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_record_type'), 'award_financial_assistance', ['record_type'], unique=False)
    op.create_index(op.f('ix_award_financial_assistance_row_number'), 'award_financial_assistance', ['row_number'], unique=False)
    op.create_index(op.f('ix_award_procurement_action_date'), 'award_procurement', ['action_date'], unique=False)
    op.create_index(op.f('ix_award_procurement_awardee_or_recipient_uniqu'), 'award_procurement', ['awardee_or_recipient_uniqu'], unique=False)
    op.create_index(op.f('ix_award_procurement_awarding_agency_code'), 'award_procurement', ['awarding_agency_code'], unique=False)
    op.create_index(op.f('ix_award_procurement_awarding_sub_tier_agency_c'), 'award_procurement', ['awarding_sub_tier_agency_c'], unique=False)
    op.create_index(op.f('ix_award_procurement_funding_agency_code'), 'award_procurement', ['funding_agency_code'], unique=False)
    op.create_index(op.f('ix_award_procurement_funding_sub_tier_agency_co'), 'award_procurement', ['funding_sub_tier_agency_co'], unique=False)
    op.create_index(op.f('ix_award_procurement_parent_award_id'), 'award_procurement', ['parent_award_id'], unique=False)
    op.create_index(op.f('ix_award_procurement_piid'), 'award_procurement', ['piid'], unique=False)
    op.create_index(op.f('ix_award_procurement_row_number'), 'award_procurement', ['row_number'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_action_date'), 'detached_award_financial_assistance', ['action_date'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_action_type'), 'detached_award_financial_assistance', ['action_type'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_assistance_type'), 'detached_award_financial_assistance', ['assistance_type'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_awardee_or_recipient_uniqu'), 'detached_award_financial_assistance', ['awardee_or_recipient_uniqu'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_awarding_sub_tier_agency_c'), 'detached_award_financial_assistance', ['awarding_sub_tier_agency_c'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_cfda_number'), 'detached_award_financial_assistance', ['cfda_number'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_correction_late_delete_ind'), 'detached_award_financial_assistance', ['correction_late_delete_ind'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_fain'), 'detached_award_financial_assistance', ['fain'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_funding_agency_code'), 'detached_award_financial_assistance', ['funding_agency_code'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_funding_office_code'), 'detached_award_financial_assistance', ['funding_office_code'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_funding_sub_tier_agency_co'), 'detached_award_financial_assistance', ['funding_sub_tier_agency_co'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_period_of_performance_curr'), 'detached_award_financial_assistance', ['period_of_performance_curr'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_period_of_performance_star'), 'detached_award_financial_assistance', ['period_of_performance_star'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_place_of_perform_country_c'), 'detached_award_financial_assistance', ['place_of_perform_country_c'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_place_of_performance_code'), 'detached_award_financial_assistance', ['place_of_performance_code'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_record_type'), 'detached_award_financial_assistance', ['record_type'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_row_number'), 'detached_award_financial_assistance', ['row_number'], unique=False)
    op.create_index(op.f('ix_detached_award_financial_assistance_uri'), 'detached_award_financial_assistance', ['uri'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_action_date'), 'detached_award_procurement', ['action_date'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_awardee_or_recipient_uniqu'), 'detached_award_procurement', ['awardee_or_recipient_uniqu'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_awarding_agency_code'), 'detached_award_procurement', ['awarding_agency_code'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_awarding_sub_tier_agency_c'), 'detached_award_procurement', ['awarding_sub_tier_agency_c'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_funding_agency_code'), 'detached_award_procurement', ['funding_agency_code'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_funding_sub_tier_agency_co'), 'detached_award_procurement', ['funding_sub_tier_agency_co'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_parent_award_id'), 'detached_award_procurement', ['parent_award_id'], unique=False)
    op.create_index(op.f('ix_detached_award_procurement_piid'), 'detached_award_procurement', ['piid'], unique=False)
    op.create_index(op.f('ix_object_class_program_activity_by_direct_reimbursable_fun'), 'object_class_program_activity', ['by_direct_reimbursable_fun'], unique=False)
    op.create_index(op.f('ix_object_class_program_activity_object_class'), 'object_class_program_activity', ['object_class'], unique=False)
    op.create_index(op.f('ix_object_class_program_activity_program_activity_code'), 'object_class_program_activity', ['program_activity_code'], unique=False)
    op.create_index(op.f('ix_object_class_program_activity_row_number'), 'object_class_program_activity', ['row_number'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_action_date'), 'published_award_financial_assistance', ['action_date'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_action_type'), 'published_award_financial_assistance', ['action_type'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_assistance_type'), 'published_award_financial_assistance', ['assistance_type'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_awardee_or_recipient_uniqu'), 'published_award_financial_assistance', ['awardee_or_recipient_uniqu'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_awarding_agency_code'), 'published_award_financial_assistance', ['awarding_agency_code'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_awarding_sub_tier_agency_c'), 'published_award_financial_assistance', ['awarding_sub_tier_agency_c'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_cfda_number'), 'published_award_financial_assistance', ['cfda_number'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_correction_late_delete_ind'), 'published_award_financial_assistance', ['correction_late_delete_ind'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_fain'), 'published_award_financial_assistance', ['fain'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_funding_agency_code'), 'published_award_financial_assistance', ['funding_agency_code'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_funding_office_code'), 'published_award_financial_assistance', ['funding_office_code'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_funding_sub_tier_agency_co'), 'published_award_financial_assistance', ['funding_sub_tier_agency_co'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_period_of_performance_curr'), 'published_award_financial_assistance', ['period_of_performance_curr'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_period_of_performance_star'), 'published_award_financial_assistance', ['period_of_performance_star'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_place_of_perform_country_c'), 'published_award_financial_assistance', ['place_of_perform_country_c'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_place_of_performance_congr'), 'published_award_financial_assistance', ['place_of_performance_congr'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_record_type'), 'published_award_financial_assistance', ['record_type'], unique=False)
    op.create_index(op.f('ix_published_award_financial_assistance_uri'), 'published_award_financial_assistance', ['uri'], 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_uri'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_record_type'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_place_of_performance_congr'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_place_of_perform_country_c'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_period_of_performance_star'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_period_of_performance_curr'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_funding_sub_tier_agency_co'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_funding_office_code'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_funding_agency_code'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_fain'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_correction_late_delete_ind'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_cfda_number'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_awarding_sub_tier_agency_c'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_awarding_agency_code'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_awardee_or_recipient_uniqu'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_assistance_type'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_action_type'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_published_award_financial_assistance_action_date'), table_name='published_award_financial_assistance')
    op.drop_index(op.f('ix_object_class_program_activity_row_number'), table_name='object_class_program_activity')
    op.drop_index(op.f('ix_object_class_program_activity_program_activity_code'), table_name='object_class_program_activity')
    op.drop_index(op.f('ix_object_class_program_activity_object_class'), table_name='object_class_program_activity')
    op.drop_index(op.f('ix_object_class_program_activity_by_direct_reimbursable_fun'), table_name='object_class_program_activity')
    op.drop_index(op.f('ix_detached_award_procurement_piid'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_procurement_parent_award_id'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_procurement_funding_sub_tier_agency_co'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_procurement_funding_agency_code'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_procurement_awarding_sub_tier_agency_c'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_procurement_awarding_agency_code'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_procurement_awardee_or_recipient_uniqu'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_procurement_action_date'), table_name='detached_award_procurement')
    op.drop_index(op.f('ix_detached_award_financial_assistance_uri'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_row_number'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_record_type'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_place_of_performance_code'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_place_of_perform_country_c'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_period_of_performance_star'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_period_of_performance_curr'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_funding_sub_tier_agency_co'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_funding_office_code'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_funding_agency_code'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_fain'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_correction_late_delete_ind'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_cfda_number'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_awarding_sub_tier_agency_c'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_awardee_or_recipient_uniqu'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_assistance_type'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_action_type'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_detached_award_financial_assistance_action_date'), table_name='detached_award_financial_assistance')
    op.drop_index(op.f('ix_award_procurement_row_number'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_procurement_piid'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_procurement_parent_award_id'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_procurement_funding_sub_tier_agency_co'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_procurement_funding_agency_code'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_procurement_awarding_sub_tier_agency_c'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_procurement_awarding_agency_code'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_procurement_awardee_or_recipient_uniqu'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_procurement_action_date'), table_name='award_procurement')
    op.drop_index(op.f('ix_award_financial_assistance_row_number'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_record_type'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_funding_sub_tier_agency_co'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_funding_agency_code'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_federal_action_obligation'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_correction_late_delete_ind'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_cfda_number'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_awarding_sub_tier_agency_c'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_awarding_agency_code'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_awardee_or_recipient_uniqu'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_assistance_type'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_action_type'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_assistance_action_date'), table_name='award_financial_assistance')
    op.drop_index(op.f('ix_award_financial_tas_id'), table_name='award_financial')
    op.drop_index(op.f('ix_award_financial_tas'), table_name='award_financial')
    op.drop_index(op.f('ix_award_financial_row_number'), table_name='award_financial')
    op.drop_index(op.f('ix_award_financial_program_activity_code'), table_name='award_financial')
    op.drop_index(op.f('ix_award_financial_parent_award_id'), table_name='award_financial')
    op.drop_index(op.f('ix_award_financial_object_class'), table_name='award_financial')
    op.drop_index(op.f('ix_award_financial_main_account_code'), table_name='award_financial')
    op.drop_index(op.f('ix_award_financial_allocation_transfer_agency'), table_name='award_financial')
    op.drop_index(op.f('ix_award_financial_agency_identifier'), table_name='award_financial')
    op.drop_index(op.f('ix_appropriation_tas_id'), table_name='appropriation')
    op.drop_index(op.f('ix_appropriation_row_number'), table_name='appropriation')
    op.create_index('ix_published_award_financial_assistance_correction_late_fa61', 'published_award_financial_assistance', ['correction_late_delete_ind'], unique=False)
    ### end Alembic commands ###

