"""add unique_award_key to transaction tables

Revision ID: 4bbc47f2b48d
Revises: ab4eac43f605
Create Date: 2018-10-10 17:17:34.091022

"""

# revision identifiers, used by Alembic.
revision = '4bbc47f2b48d'
down_revision = 'ab4eac43f605'
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.add_column('detached_award_procurement', sa.Column('unique_award_key', sa.Text(), nullable=True))
    op.create_index(op.f('ix_detached_award_procurement_unique_award_key'), 'detached_award_procurement', ['unique_award_key'], unique=False)
    op.add_column('detached_award_financial_assistance', sa.Column('unique_award_key', sa.Text(), nullable=True))
    op.create_index(op.f('ix_detached_award_financial_assistance_unique_award_key'), 'detached_award_financial_assistance', ['unique_award_key'], unique=False)
    op.add_column('published_award_financial_assistance', sa.Column('unique_award_key', sa.Text(), nullable=True))
    op.create_index(op.f('ix_published_award_financial_assistance_unique_award_key'), 'published_award_financial_assistance', ['unique_award_key'], 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_unique_award_key'), table_name='published_award_financial_assistance')
    op.drop_column('published_award_financial_assistance', 'unique_award_key')
    op.drop_index(op.f('ix_detached_award_financial_assistance_unique_award_key'), table_name='detached_award_financial_assistance')
    op.drop_column('detached_award_financial_assistance', 'unique_award_key')
    op.drop_index(op.f('ix_detached_award_procurement_unique_award_key'), table_name='detached_award_procurement')
    op.drop_column('detached_award_procurement', 'unique_award_key')
    # ### end Alembic commands ###

