"""removing FK constraints to tas_id and tas_lookup_sanity_check

Revision ID: 46d1fec96d66
Revises: 98e33bf8ff23
Create Date: 2017-01-30 12:40:57.299900

"""

# revision identifiers, used by Alembic.
revision = '46d1fec96d66'
down_revision = '98e33bf8ff23'
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_constraint('fk_tas', 'appropriation', type_='foreignkey')
    op.drop_constraint('fk_tas', 'award_financial', type_='foreignkey')
    op.drop_constraint('fk_tas', 'object_class_program_activity', type_='foreignkey')
    op.drop_constraint('fk_sf_133_tas_lookup', 'sf_133', type_='foreignkey')
    op.drop_constraint('tas_lookup_sanity_check', 'tas_lookup', type_='unique')
    ### end Alembic commands ###


def downgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_unique_constraint('tas_lookup_sanity_check', 'tas_lookup', ['account_num', 'allocation_transfer_agency', 'agency_identifier', 'beginning_period_of_availa', 'ending_period_of_availabil', 'availability_type_code', 'main_account_code', 'sub_account_code'])
    op.create_foreign_key('fk_sf_133_tas_lookup', 'sf_133', 'tas_lookup', ['tas_id'], ['tas_id'])
    op.create_foreign_key('fk_tas', 'object_class_program_activity', 'tas_lookup', ['tas_id'], ['tas_id'])
    op.create_foreign_key('fk_tas', 'award_financial', 'tas_lookup', ['tas_id'], ['tas_id'])
    op.create_foreign_key('fk_tas', 'appropriation', 'tas_lookup', ['tas_id'], ['tas_id'])
    ### end Alembic commands ###

