"""Rename award_procurement columns for DAIMS2.2

Revision ID: 7a7da8badfff
Revises: 5cb2560ae8e6
Create Date: 2022-10-04 11:29:47.407217

"""

# revision identifiers, used by Alembic.
revision = '7a7da8badfff'
down_revision = '5cb2560ae8e6'
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! ###
    # D1 table
    op.execute('ALTER TABLE award_procurement RENAME COLUMN fed_biz_opps TO contract_opp_notice')
    op.execute('ALTER TABLE award_procurement RENAME COLUMN fed_biz_opps_description TO contract_opp_notice_desc')
    op.execute('ALTER TABLE award_procurement RENAME COLUMN vendor_doing_as_business_n TO entity_doing_as_business_n')
    op.execute('ALTER TABLE award_procurement RENAME COLUMN vendor_phone_number TO entity_phone_number')
    op.execute('ALTER TABLE award_procurement RENAME COLUMN vendor_fax_number TO entity_fax_number')

    # Published D1 table
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN fed_biz_opps TO contract_opp_notice')
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN fed_biz_opps_description TO contract_opp_notice_desc')
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN vendor_doing_as_business_n TO entity_doing_as_business_n')
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN vendor_phone_number TO entity_phone_number')
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN vendor_fax_number TO entity_fax_number')
    # ### end Alembic commands ###


def downgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    # D1 table
    op.execute('ALTER TABLE award_procurement RENAME COLUMN contract_opp_notice TO fed_biz_opps')
    op.execute('ALTER TABLE award_procurement RENAME COLUMN contract_opp_notice_desc TO fed_biz_opps_description')
    op.execute('ALTER TABLE award_procurement RENAME COLUMN entity_doing_as_business_n TO vendor_doing_as_business_n')
    op.execute('ALTER TABLE award_procurement RENAME COLUMN entity_phone_number TO vendor_phone_number')
    op.execute('ALTER TABLE award_procurement RENAME COLUMN entity_fax_number TO vendor_fax_number')

    # Published D1 table
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN contract_opp_notice TO fed_biz_opps')
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN contract_opp_notice_desc TO fed_biz_opps_description')
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN entity_doing_as_business_n TO vendor_doing_as_business_n')
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN entity_phone_number TO vendor_phone_number')
    op.execute('ALTER TABLE published_award_procurement RENAME COLUMN entity_fax_number TO vendor_fax_number')
    # ### end Alembic commands ###

