"""Rename and add office type booleans in office table

Revision ID: 778cabef7323
Revises: 7dd3f4b007e5
Create Date: 2019-05-10 10:01:26.888903

"""

# revision identifiers, used by Alembic.
revision = '778cabef7323'
down_revision = '5f29b283f23e'
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.execute("ALTER TABLE office RENAME COLUMN funding_office TO contract_funding_office")
    op.execute("ALTER TABLE office RENAME COLUMN contracting_office TO contract_awards_office")
    op.execute("ALTER TABLE office RENAME COLUMN financial_assistance_office TO financial_assistance_awards_office")
    op.add_column('office', sa.Column('financial_assistance_funding_office', sa.Boolean(), server_default='False', nullable=False))
    # ### end Alembic commands ###


def downgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute("ALTER TABLE office RENAME COLUMN contract_funding_office TO funding_office")
    op.execute("ALTER TABLE office RENAME COLUMN contract_awards_office TO contracting_office")
    op.execute("ALTER TABLE office RENAME COLUMN financial_assistance_awards_office TO financial_assistance_office")
    op.drop_column('office', 'financial_assistance_funding_office')
    # ### end Alembic commands ###

