"""Add TokenBlockListModel modifications

Revision ID: d38e7da2290f
Revises: 5f1939649acf
Create Date: 2021-07-30 10:18:03.898131

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'd38e7da2290f'
down_revision = '5f1939649acf'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('blocked_tokens', sa.Column('business_id', sa.Integer(), nullable=True))
    op.alter_column('blocked_tokens', 'client_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.create_foreign_key(op.f('fk_blocked_tokens_business_id_businesses'), 'blocked_tokens', 'businesses', ['business_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(op.f('fk_blocked_tokens_business_id_businesses'), 'blocked_tokens', type_='foreignkey')
    op.alter_column('blocked_tokens', 'client_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.drop_column('blocked_tokens', 'business_id')
    # ### end Alembic commands ###
