"""empty message

Revision ID: 16d5c817baf4
Revises: 69ec475763f6
Create Date: 2020-08-29 16:38:27.647403

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

# revision identifiers, used by Alembic.
revision = '16d5c817baf4'
down_revision = '69ec475763f6'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('sys_department', sa.Column('parent_ids', sa.String(length=500), nullable=True, comment='部门父级ids'))
    op.create_index(op.f('ix_sys_department_parent_ids'), 'sys_department', ['parent_ids'], unique=False)
    op.alter_column('vote_activity_manage', 'lottery_num',
               existing_type=mysql.SMALLINT(),
               comment='一次投票活动中用户的抽奖次数限制',
               existing_comment='一次投票活动用户中奖后是否还可以抽奖',
               existing_nullable=True)
    op.add_column('vote_comment_support', sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'))
    op.add_column('vote_comment_support', sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'))
    op.alter_column('vote_comment_support', 'create_by_id',
               existing_type=mysql.BIGINT(),
               comment='创建者ID',
               existing_comment='创建者ID,即关注者ID',
               existing_nullable=True)
    op.create_index(op.f('ix_vote_comment_support_change_by_id'), 'vote_comment_support', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_support_deleted_by_id'), 'vote_comment_support', ['deleted_by_id'], unique=False)
    op.add_column('vote_player_comment', sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'))
    op.add_column('vote_player_comment', sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'))
    op.alter_column('vote_player_comment', 'create_by_id',
               existing_type=mysql.BIGINT(),
               comment='创建者ID',
               existing_comment='创建者ID,即关注者ID',
               existing_nullable=True)
    op.create_index(op.f('ix_vote_player_comment_change_by_id'), 'vote_player_comment', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_player_comment_deleted_by_id'), 'vote_player_comment', ['deleted_by_id'], unique=False)
    op.add_column('vote_subscriber_gift', sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'))
    op.add_column('vote_subscriber_gift', sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'))
    op.alter_column('vote_subscriber_gift', 'create_by_id',
               existing_type=mysql.BIGINT(),
               comment='创建者ID',
               existing_comment='创建者ID,即关注者ID',
               existing_nullable=True)
    op.create_index(op.f('ix_vote_subscriber_gift_change_by_id'), 'vote_subscriber_gift', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_subscriber_gift_deleted_by_id'), 'vote_subscriber_gift', ['deleted_by_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_vote_subscriber_gift_deleted_by_id'), table_name='vote_subscriber_gift')
    op.drop_index(op.f('ix_vote_subscriber_gift_change_by_id'), table_name='vote_subscriber_gift')
    op.alter_column('vote_subscriber_gift', 'create_by_id',
               existing_type=mysql.BIGINT(),
               comment='创建者ID,即关注者ID',
               existing_comment='创建者ID',
               existing_nullable=True)
    op.drop_column('vote_subscriber_gift', 'deleted_by_id')
    op.drop_column('vote_subscriber_gift', 'change_by_id')
    op.drop_index(op.f('ix_vote_player_comment_deleted_by_id'), table_name='vote_player_comment')
    op.drop_index(op.f('ix_vote_player_comment_change_by_id'), table_name='vote_player_comment')
    op.alter_column('vote_player_comment', 'create_by_id',
               existing_type=mysql.BIGINT(),
               comment='创建者ID,即关注者ID',
               existing_comment='创建者ID',
               existing_nullable=True)
    op.drop_column('vote_player_comment', 'deleted_by_id')
    op.drop_column('vote_player_comment', 'change_by_id')
    op.drop_index(op.f('ix_vote_comment_support_deleted_by_id'), table_name='vote_comment_support')
    op.drop_index(op.f('ix_vote_comment_support_change_by_id'), table_name='vote_comment_support')
    op.alter_column('vote_comment_support', 'create_by_id',
               existing_type=mysql.BIGINT(),
               comment='创建者ID,即关注者ID',
               existing_comment='创建者ID',
               existing_nullable=True)
    op.drop_column('vote_comment_support', 'deleted_by_id')
    op.drop_column('vote_comment_support', 'change_by_id')
    op.alter_column('vote_activity_manage', 'lottery_num',
               existing_type=mysql.SMALLINT(),
               comment='一次投票活动用户中奖后是否还可以抽奖',
               existing_comment='一次投票活动中用户的抽奖次数限制',
               existing_nullable=True)
    op.drop_index(op.f('ix_sys_department_parent_ids'), table_name='sys_department')
    op.drop_column('sys_department', 'parent_ids')
    # ### end Alembic commands ###
