"""add_fsrs_tables

Revision ID: caa6895e7450
Revises: b0445ef35b9a
Create Date: 2016-08-26 00:44:49.773600

"""

# revision identifiers, used by Alembic.
revision = 'caa6895e7450'
down_revision = 'b0445ef35b9a'
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('fsrs_grant',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('duns', sa.String(), nullable=True),
    sa.Column('dba_name', sa.String(), nullable=True),
    sa.Column('principle_place_city', sa.String(), nullable=True),
    sa.Column('principle_place_street', sa.String(), nullable=True),
    sa.Column('principle_place_state', sa.String(), nullable=True),
    sa.Column('principle_place_country', sa.String(), nullable=True),
    sa.Column('principle_place_zip', sa.String(), nullable=True),
    sa.Column('principle_place_district', sa.String(), nullable=True),
    sa.Column('parent_duns', sa.String(), nullable=True),
    sa.Column('funding_agency_id', sa.String(), nullable=True),
    sa.Column('funding_agency_name', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_1', sa.String(), nullable=True),
    sa.Column('top_paid_amount_1', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_2', sa.String(), nullable=True),
    sa.Column('top_paid_amount_2', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_3', sa.String(), nullable=True),
    sa.Column('top_paid_amount_3', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_4', sa.String(), nullable=True),
    sa.Column('top_paid_amount_4', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_5', sa.String(), nullable=True),
    sa.Column('top_paid_amount_5', sa.String(), nullable=True),
    sa.Column('dunsplus4', sa.String(), nullable=True),
    sa.Column('awardee_name', sa.String(), nullable=True),
    sa.Column('awardee_address_city', sa.String(), nullable=True),
    sa.Column('awardee_address_street', sa.String(), nullable=True),
    sa.Column('awardee_address_state', sa.String(), nullable=True),
    sa.Column('awardee_address_country', sa.String(), nullable=True),
    sa.Column('awardee_address_zip', sa.String(), nullable=True),
    sa.Column('awardee_address_district', sa.String(), nullable=True),
    sa.Column('cfda_numbers', sa.String(), nullable=True),
    sa.Column('project_description', sa.String(), nullable=True),
    sa.Column('compensation_q1', sa.Boolean(), nullable=True),
    sa.Column('compensation_q2', sa.Boolean(), nullable=True),
    sa.Column('internal_id', sa.String(), nullable=True),
    sa.Column('date_submitted', sa.DateTime(), nullable=True),
    sa.Column('report_period_mon', sa.String(), nullable=True),
    sa.Column('report_period_year', sa.String(), nullable=True),
    sa.Column('fain', sa.String(), nullable=True),
    sa.Column('total_fed_funding_amount', sa.String(), nullable=True),
    sa.Column('obligation_date', sa.Date(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('fsrs_procurement',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('duns', sa.String(), nullable=True),
    sa.Column('dba_name', sa.String(), nullable=True),
    sa.Column('principle_place_city', sa.String(), nullable=True),
    sa.Column('principle_place_street', sa.String(), nullable=True),
    sa.Column('principle_place_state', sa.String(), nullable=True),
    sa.Column('principle_place_country', sa.String(), nullable=True),
    sa.Column('principle_place_zip', sa.String(), nullable=True),
    sa.Column('principle_place_district', sa.String(), nullable=True),
    sa.Column('parent_duns', sa.String(), nullable=True),
    sa.Column('funding_agency_id', sa.String(), nullable=True),
    sa.Column('funding_agency_name', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_1', sa.String(), nullable=True),
    sa.Column('top_paid_amount_1', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_2', sa.String(), nullable=True),
    sa.Column('top_paid_amount_2', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_3', sa.String(), nullable=True),
    sa.Column('top_paid_amount_3', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_4', sa.String(), nullable=True),
    sa.Column('top_paid_amount_4', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_5', sa.String(), nullable=True),
    sa.Column('top_paid_amount_5', sa.String(), nullable=True),
    sa.Column('company_name', sa.String(), nullable=True),
    sa.Column('bus_types', sa.String(), nullable=True),
    sa.Column('company_address_city', sa.String(), nullable=True),
    sa.Column('company_address_street', sa.String(), nullable=True),
    sa.Column('company_address_state', sa.String(), nullable=True),
    sa.Column('company_address_country', sa.String(), nullable=True),
    sa.Column('company_address_zip', sa.String(), nullable=True),
    sa.Column('company_address_district', sa.String(), nullable=True),
    sa.Column('parent_company_name', sa.String(), nullable=True),
    sa.Column('naics', sa.String(), nullable=True),
    sa.Column('funding_office_id', sa.String(), nullable=True),
    sa.Column('funding_office_name', sa.String(), nullable=True),
    sa.Column('recovery_model_q1', sa.Boolean(), nullable=True),
    sa.Column('recovery_model_q2', sa.Boolean(), nullable=True),
    sa.Column('internal_id', sa.String(), nullable=True),
    sa.Column('date_submitted', sa.DateTime(), nullable=True),
    sa.Column('report_period_mon', sa.String(), nullable=True),
    sa.Column('report_period_year', sa.String(), nullable=True),
    sa.Column('contract_number', sa.String(), nullable=True),
    sa.Column('idv_reference_number', sa.String(), nullable=True),
    sa.Column('report_type', sa.String(), nullable=True),
    sa.Column('contract_agency_code', sa.String(), nullable=True),
    sa.Column('contract_idv_agency_code', sa.String(), nullable=True),
    sa.Column('contracting_office_aid', sa.String(), nullable=True),
    sa.Column('contracting_office_aname', sa.String(), nullable=True),
    sa.Column('contracting_office_id', sa.String(), nullable=True),
    sa.Column('contracting_office_name', sa.String(), nullable=True),
    sa.Column('treasury_symbol', sa.String(), nullable=True),
    sa.Column('dollar_obligated', sa.String(), nullable=True),
    sa.Column('date_signed', sa.Date(), nullable=True),
    sa.Column('transaction_type', sa.String(), nullable=True),
    sa.Column('program_title', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('fsrs_subcontract',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('duns', sa.String(), nullable=True),
    sa.Column('dba_name', sa.String(), nullable=True),
    sa.Column('principle_place_city', sa.String(), nullable=True),
    sa.Column('principle_place_street', sa.String(), nullable=True),
    sa.Column('principle_place_state', sa.String(), nullable=True),
    sa.Column('principle_place_country', sa.String(), nullable=True),
    sa.Column('principle_place_zip', sa.String(), nullable=True),
    sa.Column('principle_place_district', sa.String(), nullable=True),
    sa.Column('parent_duns', sa.String(), nullable=True),
    sa.Column('funding_agency_id', sa.String(), nullable=True),
    sa.Column('funding_agency_name', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_1', sa.String(), nullable=True),
    sa.Column('top_paid_amount_1', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_2', sa.String(), nullable=True),
    sa.Column('top_paid_amount_2', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_3', sa.String(), nullable=True),
    sa.Column('top_paid_amount_3', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_4', sa.String(), nullable=True),
    sa.Column('top_paid_amount_4', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_5', sa.String(), nullable=True),
    sa.Column('top_paid_amount_5', sa.String(), nullable=True),
    sa.Column('company_name', sa.String(), nullable=True),
    sa.Column('bus_types', sa.String(), nullable=True),
    sa.Column('company_address_city', sa.String(), nullable=True),
    sa.Column('company_address_street', sa.String(), nullable=True),
    sa.Column('company_address_state', sa.String(), nullable=True),
    sa.Column('company_address_country', sa.String(), nullable=True),
    sa.Column('company_address_zip', sa.String(), nullable=True),
    sa.Column('company_address_district', sa.String(), nullable=True),
    sa.Column('parent_company_name', sa.String(), nullable=True),
    sa.Column('naics', sa.String(), nullable=True),
    sa.Column('funding_office_id', sa.String(), nullable=True),
    sa.Column('funding_office_name', sa.String(), nullable=True),
    sa.Column('recovery_model_q1', sa.Boolean(), nullable=True),
    sa.Column('recovery_model_q2', sa.Boolean(), nullable=True),
    sa.Column('parent_id', sa.Integer(), nullable=True),
    sa.Column('subcontract_amount', sa.String(), nullable=True),
    sa.Column('subcontract_date', sa.Date(), nullable=True),
    sa.Column('subcontract_num', sa.String(), nullable=True),
    sa.Column('overall_description', sa.Text(), nullable=True),
    sa.Column('recovery_subcontract_amt', sa.String(), nullable=True),
    sa.ForeignKeyConstraint(['parent_id'], ['fsrs_procurement.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('fsrs_subgrant',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('duns', sa.String(), nullable=True),
    sa.Column('dba_name', sa.String(), nullable=True),
    sa.Column('principle_place_city', sa.String(), nullable=True),
    sa.Column('principle_place_street', sa.String(), nullable=True),
    sa.Column('principle_place_state', sa.String(), nullable=True),
    sa.Column('principle_place_country', sa.String(), nullable=True),
    sa.Column('principle_place_zip', sa.String(), nullable=True),
    sa.Column('principle_place_district', sa.String(), nullable=True),
    sa.Column('parent_duns', sa.String(), nullable=True),
    sa.Column('funding_agency_id', sa.String(), nullable=True),
    sa.Column('funding_agency_name', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_1', sa.String(), nullable=True),
    sa.Column('top_paid_amount_1', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_2', sa.String(), nullable=True),
    sa.Column('top_paid_amount_2', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_3', sa.String(), nullable=True),
    sa.Column('top_paid_amount_3', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_4', sa.String(), nullable=True),
    sa.Column('top_paid_amount_4', sa.String(), nullable=True),
    sa.Column('top_paid_fullname_5', sa.String(), nullable=True),
    sa.Column('top_paid_amount_5', sa.String(), nullable=True),
    sa.Column('dunsplus4', sa.String(), nullable=True),
    sa.Column('awardee_name', sa.String(), nullable=True),
    sa.Column('awardee_address_city', sa.String(), nullable=True),
    sa.Column('awardee_address_street', sa.String(), nullable=True),
    sa.Column('awardee_address_state', sa.String(), nullable=True),
    sa.Column('awardee_address_country', sa.String(), nullable=True),
    sa.Column('awardee_address_zip', sa.String(), nullable=True),
    sa.Column('awardee_address_district', sa.String(), nullable=True),
    sa.Column('cfda_numbers', sa.String(), nullable=True),
    sa.Column('project_description', sa.String(), nullable=True),
    sa.Column('compensation_q1', sa.Boolean(), nullable=True),
    sa.Column('compensation_q2', sa.Boolean(), nullable=True),
    sa.Column('parent_id', sa.Integer(), nullable=True),
    sa.Column('subaward_amount', sa.String(), nullable=True),
    sa.Column('subaward_date', sa.Date(), nullable=True),
    sa.Column('subaward_num', sa.String(), nullable=True),
    sa.ForeignKeyConstraint(['parent_id'], ['fsrs_grant.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ###


def downgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('fsrs_subgrant')
    op.drop_table('fsrs_subcontract')
    op.drop_table('fsrs_procurement')
    op.drop_table('fsrs_grant')
    ### end Alembic commands ###

