"""fixing relation bid and proposal

Revision ID: c865017a0449
Revises: ffa8732e25ee
Create Date: 2021-07-15 09:23:48.871302

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'c865017a0449'
down_revision = 'ffa8732e25ee'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('bids', sa.Column('proposal_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'bids', 'proposals', ['proposal_id'], ['id'])
    op.drop_constraint('proposals_bid_id_fkey', 'proposals', type_='foreignkey')
    op.drop_column('proposals', 'bid_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('proposals', sa.Column('bid_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.create_foreign_key('proposals_bid_id_fkey', 'proposals', 'bids', ['bid_id'], ['id'])
    op.drop_constraint(None, 'bids', type_='foreignkey')
    op.drop_column('bids', 'proposal_id')
    # ### end Alembic commands ###
