"""Create published_award_financial_assistance table

Revision ID: 88e9b634ca1a
Revises: 26cfc98728c8
Create Date: 2017-02-10 10:08:29.037013

"""

# revision identifiers, used by Alembic.
revision = '88e9b634ca1a'
down_revision = '26cfc98728c8'
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.create_table('published_award_financial_assistance',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('published_award_financial_assistance_id', sa.Integer(), nullable=False),
    sa.Column('action_date', sa.Text(), nullable=True),
    sa.Column('action_type', sa.Text(), nullable=True),
    sa.Column('assistance_type', sa.Text(), nullable=True),
    sa.Column('award_description', sa.Text(), nullable=True),
    sa.Column('awardee_or_recipient_legal', sa.Text(), nullable=True),
    sa.Column('awardee_or_recipient_uniqu', sa.Text(), nullable=True),
    sa.Column('awarding_agency_code', sa.Text(), nullable=True),
    sa.Column('awarding_office_code', sa.Text(), nullable=True),
    sa.Column('awarding_sub_tier_agency_c', sa.Text(), nullable=True),
    sa.Column('award_modification_amendme', sa.Text(), nullable=True),
    sa.Column('business_funds_indicator', sa.Text(), nullable=True),
    sa.Column('business_types', sa.Text(), nullable=True),
    sa.Column('cfda_number', sa.Text(), nullable=True),
    sa.Column('correction_late_delete_ind', sa.Text(), nullable=True),
    sa.Column('face_value_loan_guarantee', sa.Numeric(), nullable=True),
    sa.Column('fain', sa.Text(), nullable=True),
    sa.Column('federal_action_obligation', sa.Numeric(), nullable=True),
    sa.Column('fiscal_year_and_quarter_co', sa.Text(), nullable=True),
    sa.Column('funding_agency_code', sa.Text(), nullable=True),
    sa.Column('funding_office_code', sa.Text(), nullable=True),
    sa.Column('funding_sub_tier_agency_co', sa.Text(), nullable=True),
    sa.Column('legal_entity_address_line1', sa.Text(), nullable=True),
    sa.Column('legal_entity_address_line2', sa.Text(), nullable=True),
    sa.Column('legal_entity_address_line3', sa.Text(), nullable=True),
    sa.Column('legal_entity_country_code', sa.Text(), nullable=True),
    sa.Column('legal_entity_foreign_city', sa.Text(), nullable=True),
    sa.Column('legal_entity_foreign_posta', sa.Text(), nullable=True),
    sa.Column('legal_entity_foreign_provi', sa.Text(), nullable=True),
    sa.Column('legal_entity_zip5', sa.Text(), nullable=True),
    sa.Column('legal_entity_zip_last4', sa.Text(), nullable=True),
    sa.Column('non_federal_funding_amount', sa.Numeric(), nullable=True),
    sa.Column('original_loan_subsidy_cost', sa.Numeric(), nullable=True),
    sa.Column('period_of_performance_curr', sa.Text(), nullable=True),
    sa.Column('period_of_performance_star', sa.Text(), nullable=True),
    sa.Column('place_of_performance_code', sa.Text(), nullable=True),
    sa.Column('place_of_performance_congr', sa.Text(), nullable=True),
    sa.Column('place_of_perform_country_c', sa.Text(), nullable=True),
    sa.Column('place_of_performance_forei', sa.Text(), nullable=True),
    sa.Column('place_of_performance_zip4a', sa.Text(), nullable=True),
    sa.Column('record_type', sa.Integer(), nullable=True),
    sa.Column('sai_number', sa.Text(), nullable=True),
    sa.Column('uri', sa.Text(), nullable=True),
    sa.PrimaryKeyConstraint('published_award_financial_assistance_id'),
    sa.UniqueConstraint('awarding_sub_tier_agency_c', 'award_modification_amendme', 'fain', 'uri', name='uniq_award_mod_sub_tier_fain_uri')
    )
    op.create_index(op.f('ix_published_award_financial_assistance_award_modification_amendme'), 'published_award_financial_assistance', ['award_modification_amendme'], 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_fain'), 'published_award_financial_assistance', ['fain'], 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_fain'), 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_award_modification_amendme'), table_name='published_award_financial_assistance')
    op.drop_table('published_award_financial_assistance')
    ### end Alembic commands ###

