"""renaming uei columns to match what fsrs sends

Revision ID: 6349f316e6f5
Revises: 2bfe1654bd1d
Create Date: 2021-10-28 10:37:56.694759

"""

# revision identifiers, used by Alembic.
revision = '6349f316e6f5'
down_revision = '2bfe1654bd1d'
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 fsrs_grant RENAME COLUMN uei TO uei_number')
    op.execute('ALTER TABLE fsrs_grant RENAME COLUMN ultimate_parent_uei TO parent_uei')
    op.execute('ALTER TABLE fsrs_procurement RENAME COLUMN uei TO uei_number')
    op.execute('ALTER TABLE fsrs_procurement RENAME COLUMN ultimate_parent_uei TO parent_uei')
    op.execute('ALTER TABLE fsrs_subcontract RENAME COLUMN uei TO uei_number')
    op.execute('ALTER TABLE fsrs_subcontract RENAME COLUMN ultimate_parent_uei TO parent_uei')
    op.execute('ALTER TABLE fsrs_subgrant RENAME COLUMN uei TO uei_number')
    op.execute('ALTER TABLE fsrs_subgrant RENAME COLUMN ultimate_parent_uei TO parent_uei')
    # ### end Alembic commands ###


def downgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute('ALTER TABLE fsrs_subgrant RENAME COLUMN uei_number TO uei')
    op.execute('ALTER TABLE fsrs_subgrant RENAME COLUMN parent_uei TO ultimate_parent_uei')
    op.execute('ALTER TABLE fsrs_subcontract RENAME COLUMN uei_number TO uei')
    op.execute('ALTER TABLE fsrs_subcontract RENAME COLUMN parent_uei TO ultimate_parent_uei')
    op.execute('ALTER TABLE fsrs_procurement RENAME COLUMN uei_number TO uei')
    op.execute('ALTER TABLE fsrs_procurement RENAME COLUMN parent_uei TO ultimate_parent_uei')
    op.execute('ALTER TABLE fsrs_grant RENAME COLUMN uei_number TO uei')
    op.execute('ALTER TABLE fsrs_grant RENAME COLUMN parent_uei TO ultimate_parent_uei')
    # ### end Alembic commands ###

