"""special privileges as a relationship

Revision ID: 44fbbb1fd537
Revises: 72df33816b21
Create Date: 2022-05-12 19:15:15.592896

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '44fbbb1fd537'
down_revision = '72df33816b21'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('special_privilege', sa.Column('member_id', sa.Integer(), nullable=True))
    op.drop_index('ix_special_privilege_mid', table_name='special_privilege')
    op.create_index(op.f('ix_special_privilege_member_id'), 'special_privilege', ['member_id'], unique=False)
    op.drop_constraint('special_privilege_mid_fkey', 'special_privilege', type_='foreignkey')
    op.create_foreign_key(None, 'special_privilege', 'member', ['member_id'], ['id'])
    op.drop_column('special_privilege', 'mid')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('special_privilege', sa.Column('mid', sa.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'special_privilege', type_='foreignkey')
    op.create_foreign_key('special_privilege_mid_fkey', 'special_privilege', 'member', ['mid'], ['id'])
    op.drop_index(op.f('ix_special_privilege_member_id'), table_name='special_privilege')
    op.create_index('ix_special_privilege_mid', 'special_privilege', ['mid'], unique=False)
    op.drop_column('special_privilege', 'member_id')
    # ### end Alembic commands ###
