"""Add uei and ultimate_parent_uei to FABS tables

Revision ID: 9a73f1a0ee98
Revises: 91df6b691864
Create Date: 2021-07-19 10:19:58.569679

"""

# revision identifiers, used by Alembic.
revision = '9a73f1a0ee98'
down_revision = '91df6b691864'
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_financial_assistance', sa.Column('uei', sa.Text(), nullable=True))
    op.add_column('detached_award_financial_assistance', sa.Column('ultimate_parent_uei', sa.Text(), nullable=True))
    op.create_index(op.f('ix_detached_award_financial_assistance_uei'), 'detached_award_financial_assistance', ['uei'], unique=False)
    op.add_column('published_award_financial_assistance', sa.Column('uei', sa.Text(), nullable=True))
    op.add_column('published_award_financial_assistance', sa.Column('ultimate_parent_uei', sa.Text(), nullable=True))
    op.create_index(op.f('ix_published_award_financial_assistance_uei'), 'published_award_financial_assistance', ['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_uei'), table_name='published_award_financial_assistance')
    op.drop_column('published_award_financial_assistance', 'ultimate_parent_uei')
    op.drop_column('published_award_financial_assistance', 'uei')
    op.drop_index(op.f('ix_detached_award_financial_assistance_uei'), table_name='detached_award_financial_assistance')
    op.drop_column('detached_award_financial_assistance', 'ultimate_parent_uei')
    op.drop_column('detached_award_financial_assistance', 'uei')
    # ### end Alembic commands ###

