"""Adding DEFC to SF133

Revision ID: 05edb849e42a
Revises: c8f39196cbba
Create Date: 2020-04-30 17:07:01.466026

"""

# revision identifiers, used by Alembic.
revision = '05edb849e42a'
down_revision = 'c8f39196cbba'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

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('sf_133', sa.Column('disaster_emergency_fund_code', sa.Text(), nullable=True))
    op.create_index(op.f('ix_sf_133_disaster_emergency_fund_code'), 'sf_133', ['disaster_emergency_fund_code'], unique=False)
    op.drop_index('ix_sf_133_tas_group', table_name='sf_133')
    op.create_index('ix_sf_133_tas_group', 'sf_133', ['tas', 'fiscal_year', 'period', 'line', 'disaster_emergency_fund_code'], unique=True)
    # ### end Alembic commands ###


def downgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_sf_133_tas_group', table_name='sf_133')
    op.create_index('ix_sf_133_tas_group', 'sf_133', ['tas', 'fiscal_year', 'period', 'line'], unique=True)
    op.drop_index(op.f('ix_sf_133_disaster_emergency_fund_code'), table_name='sf_133')
    op.drop_column('sf_133', 'disaster_emergency_fund_code')
    # ### end Alembic commands ###

