"""empty message

Revision ID: 5791371c4050
Revises: e6a18e61836a
Create Date: 2019-10-31 15:27:40.046543

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '5791371c4050'
down_revision = 'e6a18e61836a'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('departments', sa.Column('parent_department_id', sa.Integer(), nullable=True, comment='上级部门id'))
    op.drop_constraint('departments_ibfk_1', 'departments', type_='foreignkey')
    op.create_foreign_key(None, 'departments', 'departments', ['parent_department_id'], ['id'])
    op.drop_column('departments', 'child_department_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('departments', sa.Column('child_department_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True, comment='下级部门id'))
    op.drop_constraint(None, 'departments', type_='foreignkey')
    op.create_foreign_key('departments_ibfk_1', 'departments', 'departments', ['child_department_id'], ['id'])
    op.drop_column('departments', 'parent_department_id')
    # ### end Alembic commands ###
