"""Add relationships for assigned users to bounties

Revision ID: a14fe9823844
Revises: d263d4125e87
Create Date: 2021-03-15 14:52:43.586549

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a14fe9823844'
down_revision = 'd263d4125e87'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('bounty', sa.Column('assigned_user_id', sa.Integer(), nullable=True))
    op.create_foreign_key(op.f('fk_bounty_assigned_user_id_user'), 'bounty', 'user', ['assigned_user_id'], ['user_id'], ondelete='CASCADE')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(op.f('fk_bounty_assigned_user_id_user'), 'bounty', type_='foreignkey')
    op.drop_column('bounty', 'assigned_user_id')
    # ### end Alembic commands ###
