"""empty message

Revision ID: 97a1a95524cc
Revises: 3b69c0d9e66e
Create Date: 2020-10-28 17:46:05.296819

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '97a1a95524cc'
down_revision = '3b69c0d9e66e'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('vote_activity',
    sa.Column('id', sa.String(length=20), autoincrement=False, nullable=False, comment='主键ID'),
    sa.Column('state', sa.SmallInteger(), nullable=True, comment='状态值, 0为已删除, 1为正常, 2为锁定'),
    sa.Column('create_time', sa.DateTime(), nullable=False, comment='创建时间'),
    sa.Column('create_by_id', sa.BigInteger(), nullable=True, comment='创建者ID'),
    sa.Column('last_change_time', sa.DateTime(), nullable=True, comment='最后修改的时间'),
    sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'),
    sa.Column('deleted_time', sa.DateTime(), nullable=True, comment='删除时间'),
    sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'),
    sa.Column('activity_title', sa.String(length=50), nullable=False, comment='活动标题'),
    sa.Column('template', sa.String(length=20), nullable=False, comment='活动模板'),
    sa.Column('posters_img', sa.String(length=300), nullable=False, comment='活动海报图片链接'),
    sa.Column('start_time', sa.DateTime(), nullable=False, comment='活动开始时间'),
    sa.Column('end_time', sa.DateTime(), nullable=False, comment='活动结束时间'),
    sa.Column('activity_info', sa.String(length=3000), nullable=True, comment='活动详情'),
    sa.Column('organizers_info', sa.String(length=3000), nullable=True, comment='主办方信息'),
    sa.Column('user_vote_total', sa.Integer(), nullable=False, comment='用户投票总次数'),
    sa.Column('user_day_vote_num', sa.Integer(), nullable=False, comment='用户每天投票次数'),
    sa.Column('allow_repeat_vote', sa.Boolean(), nullable=False, comment='允许单日同一项重复被投票'),
    sa.Column('show_type', sa.Boolean(), nullable=False, comment='投票显示设置，默认宫格'),
    sa.Column('show_ticket_Num', sa.Boolean(), nullable=False, comment='是否显示票数， 默认显示'),
    sa.Column('show_ranking_list', sa.Boolean(), nullable=False, comment='是否显示排行榜，默认显示'),
    sa.Column('show_supporters_list', sa.Boolean(), nullable=False, comment='是否在选手详情页显示支持者，默认显示'),
    sa.Column('default_share', sa.Boolean(), nullable=False, comment='是否默认分享设置，默认是'),
    sa.Column('share_title', sa.String(length=50), nullable=True, comment='分享标题'),
    sa.Column('share_desc', sa.String(length=100), nullable=True, comment='分享描述'),
    sa.Column('share_img', sa.String(length=300), nullable=True, comment='分享图片链接'),
    sa.Column('open_comment', sa.Boolean(), nullable=False, comment='是否支持投票后评论，默认不支持'),
    sa.Column('total_ticket_num', sa.Integer(), nullable=False, comment='总票数'),
    sa.Column('total_visit_num', sa.Integer(), nullable=False, comment='总访问数'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id'),
    comment='投票活动表'
    )
    op.create_index(op.f('ix_vote_activity_activity_title'), 'vote_activity', ['activity_title'], unique=False)
    op.create_index(op.f('ix_vote_activity_change_by_id'), 'vote_activity', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_activity_create_by_id'), 'vote_activity', ['create_by_id'], unique=False)
    op.create_index(op.f('ix_vote_activity_deleted_by_id'), 'vote_activity', ['deleted_by_id'], unique=False)
    op.create_index(op.f('ix_vote_activity_state'), 'vote_activity', ['state'], unique=False)
    op.create_table('vote_comment',
    sa.Column('id', sa.String(length=20), autoincrement=False, nullable=False, comment='主键ID'),
    sa.Column('state', sa.SmallInteger(), nullable=True, comment='状态值, 0为已删除, 1为正常, 2为锁定'),
    sa.Column('create_time', sa.DateTime(), nullable=False, comment='创建时间'),
    sa.Column('create_by_id', sa.BigInteger(), nullable=True, comment='创建者ID'),
    sa.Column('last_change_time', sa.DateTime(), nullable=True, comment='最后修改的时间'),
    sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'),
    sa.Column('deleted_time', sa.DateTime(), nullable=True, comment='删除时间'),
    sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'),
    sa.Column('item_id', sa.String(length=20), nullable=False, comment='选手id'),
    sa.Column('comment', sa.String(length=200), nullable=False, comment='评论内容'),
    sa.Column('like_num', sa.Integer(), nullable=False, comment='点赞数'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id'),
    comment='投票评论表'
    )
    op.create_index(op.f('ix_vote_comment_change_by_id'), 'vote_comment', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_create_by_id'), 'vote_comment', ['create_by_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_deleted_by_id'), 'vote_comment', ['deleted_by_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_item_id'), 'vote_comment', ['item_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_state'), 'vote_comment', ['state'], unique=False)
    op.create_table('vote_comment_like',
    sa.Column('id', sa.String(length=20), autoincrement=False, nullable=False, comment='主键ID'),
    sa.Column('state', sa.SmallInteger(), nullable=True, comment='状态值, 0为已删除, 1为正常, 2为锁定'),
    sa.Column('create_time', sa.DateTime(), nullable=False, comment='创建时间'),
    sa.Column('create_by_id', sa.BigInteger(), nullable=True, comment='创建者ID'),
    sa.Column('last_change_time', sa.DateTime(), nullable=True, comment='最后修改的时间'),
    sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'),
    sa.Column('deleted_time', sa.DateTime(), nullable=True, comment='删除时间'),
    sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'),
    sa.Column('comment_id', sa.String(length=20), nullable=False, comment='评论id'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id'),
    comment='评论点赞表'
    )
    op.create_index(op.f('ix_vote_comment_like_change_by_id'), 'vote_comment_like', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_like_comment_id'), 'vote_comment_like', ['comment_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_like_create_by_id'), 'vote_comment_like', ['create_by_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_like_deleted_by_id'), 'vote_comment_like', ['deleted_by_id'], unique=False)
    op.create_index(op.f('ix_vote_comment_like_state'), 'vote_comment_like', ['state'], unique=False)
    op.create_table('vote_item',
    sa.Column('id', sa.String(length=20), autoincrement=False, nullable=False, comment='主键ID'),
    sa.Column('state', sa.SmallInteger(), nullable=True, comment='状态值, 0为已删除, 1为正常, 2为锁定'),
    sa.Column('create_time', sa.DateTime(), nullable=False, comment='创建时间'),
    sa.Column('create_by_id', sa.BigInteger(), nullable=True, comment='创建者ID'),
    sa.Column('last_change_time', sa.DateTime(), nullable=True, comment='最后修改的时间'),
    sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'),
    sa.Column('deleted_time', sa.DateTime(), nullable=True, comment='删除时间'),
    sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'),
    sa.Column('item_name', sa.String(length=50), nullable=False, comment='选手名称'),
    sa.Column('item_img', sa.String(length=300), nullable=False, comment='选手图片'),
    sa.Column('item_no', sa.Integer(), nullable=False, comment='选手编号'),
    sa.Column('ticket_num', sa.Integer(), nullable=False, comment='票数'),
    sa.Column('item_info', sa.Text(), nullable=True, comment='选手详情'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id'),
    comment='投票选手表'
    )
    op.create_index(op.f('ix_vote_item_change_by_id'), 'vote_item', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_item_create_by_id'), 'vote_item', ['create_by_id'], unique=False)
    op.create_index(op.f('ix_vote_item_deleted_by_id'), 'vote_item', ['deleted_by_id'], unique=False)
    op.create_index(op.f('ix_vote_item_item_name'), 'vote_item', ['item_name'], unique=False)
    op.create_index(op.f('ix_vote_item_state'), 'vote_item', ['state'], unique=False)
    op.create_table('vote_manage',
    sa.Column('id', sa.String(length=20), autoincrement=False, nullable=False, comment='主键ID'),
    sa.Column('state', sa.SmallInteger(), nullable=True, comment='状态值, 0为已删除, 1为正常, 2为锁定'),
    sa.Column('create_time', sa.DateTime(), nullable=False, comment='创建时间'),
    sa.Column('create_by_id', sa.BigInteger(), nullable=True, comment='创建者ID'),
    sa.Column('last_change_time', sa.DateTime(), nullable=True, comment='最后修改的时间'),
    sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'),
    sa.Column('deleted_time', sa.DateTime(), nullable=True, comment='删除时间'),
    sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'),
    sa.Column('temp_name', sa.String(length=50), nullable=False, comment='模板名称'),
    sa.Column('temp_img', sa.String(length=300), nullable=False, comment='模板背景图片链接'),
    sa.Column('posters_img', sa.String(length=300), nullable=False, comment='模板海报图片链接'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id'),
    comment='投票模板表'
    )
    op.create_index(op.f('ix_vote_manage_change_by_id'), 'vote_manage', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_manage_create_by_id'), 'vote_manage', ['create_by_id'], unique=False)
    op.create_index(op.f('ix_vote_manage_deleted_by_id'), 'vote_manage', ['deleted_by_id'], unique=False)
    op.create_index(op.f('ix_vote_manage_state'), 'vote_manage', ['state'], unique=False)
    op.create_index(op.f('ix_vote_manage_temp_name'), 'vote_manage', ['temp_name'], unique=False)
    op.create_table('vote_user',
    sa.Column('id', sa.String(length=20), autoincrement=False, nullable=False, comment='主键ID'),
    sa.Column('state', sa.SmallInteger(), nullable=True, comment='状态值, 0为已删除, 1为正常, 2为锁定'),
    sa.Column('create_time', sa.DateTime(), nullable=False, comment='创建时间'),
    sa.Column('create_by_id', sa.BigInteger(), nullable=True, comment='创建者ID'),
    sa.Column('last_change_time', sa.DateTime(), nullable=True, comment='最后修改的时间'),
    sa.Column('change_by_id', sa.BigInteger(), nullable=True, comment='最后修改者ID'),
    sa.Column('deleted_time', sa.DateTime(), nullable=True, comment='删除时间'),
    sa.Column('deleted_by_id', sa.BigInteger(), nullable=True, comment='删除者id'),
    sa.Column('item_id', sa.String(length=20), nullable=False, comment='选手id'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id'),
    comment='投票用户表'
    )
    op.create_index(op.f('ix_vote_user_change_by_id'), 'vote_user', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_vote_user_create_by_id'), 'vote_user', ['create_by_id'], unique=False)
    op.create_index(op.f('ix_vote_user_deleted_by_id'), 'vote_user', ['deleted_by_id'], unique=False)
    op.create_index(op.f('ix_vote_user_item_id'), 'vote_user', ['item_id'], unique=False)
    op.create_index(op.f('ix_vote_user_state'), 'vote_user', ['state'], unique=False)
    op.add_column('sys_user', sa.Column('subscriber_id', sa.String(length=20), nullable=False, comment='粉丝id'))
    op.create_index(op.f('ix_sys_user_subscriber_id'), 'sys_user', ['subscriber_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_sys_user_subscriber_id'), table_name='sys_user')
    op.drop_column('sys_user', 'subscriber_id')
    op.drop_index(op.f('ix_vote_user_state'), table_name='vote_user')
    op.drop_index(op.f('ix_vote_user_item_id'), table_name='vote_user')
    op.drop_index(op.f('ix_vote_user_deleted_by_id'), table_name='vote_user')
    op.drop_index(op.f('ix_vote_user_create_by_id'), table_name='vote_user')
    op.drop_index(op.f('ix_vote_user_change_by_id'), table_name='vote_user')
    op.drop_table('vote_user')
    op.drop_index(op.f('ix_vote_manage_temp_name'), table_name='vote_manage')
    op.drop_index(op.f('ix_vote_manage_state'), table_name='vote_manage')
    op.drop_index(op.f('ix_vote_manage_deleted_by_id'), table_name='vote_manage')
    op.drop_index(op.f('ix_vote_manage_create_by_id'), table_name='vote_manage')
    op.drop_index(op.f('ix_vote_manage_change_by_id'), table_name='vote_manage')
    op.drop_table('vote_manage')
    op.drop_index(op.f('ix_vote_item_state'), table_name='vote_item')
    op.drop_index(op.f('ix_vote_item_item_name'), table_name='vote_item')
    op.drop_index(op.f('ix_vote_item_deleted_by_id'), table_name='vote_item')
    op.drop_index(op.f('ix_vote_item_create_by_id'), table_name='vote_item')
    op.drop_index(op.f('ix_vote_item_change_by_id'), table_name='vote_item')
    op.drop_table('vote_item')
    op.drop_index(op.f('ix_vote_comment_like_state'), table_name='vote_comment_like')
    op.drop_index(op.f('ix_vote_comment_like_deleted_by_id'), table_name='vote_comment_like')
    op.drop_index(op.f('ix_vote_comment_like_create_by_id'), table_name='vote_comment_like')
    op.drop_index(op.f('ix_vote_comment_like_comment_id'), table_name='vote_comment_like')
    op.drop_index(op.f('ix_vote_comment_like_change_by_id'), table_name='vote_comment_like')
    op.drop_table('vote_comment_like')
    op.drop_index(op.f('ix_vote_comment_state'), table_name='vote_comment')
    op.drop_index(op.f('ix_vote_comment_item_id'), table_name='vote_comment')
    op.drop_index(op.f('ix_vote_comment_deleted_by_id'), table_name='vote_comment')
    op.drop_index(op.f('ix_vote_comment_create_by_id'), table_name='vote_comment')
    op.drop_index(op.f('ix_vote_comment_change_by_id'), table_name='vote_comment')
    op.drop_table('vote_comment')
    op.drop_index(op.f('ix_vote_activity_state'), table_name='vote_activity')
    op.drop_index(op.f('ix_vote_activity_deleted_by_id'), table_name='vote_activity')
    op.drop_index(op.f('ix_vote_activity_create_by_id'), table_name='vote_activity')
    op.drop_index(op.f('ix_vote_activity_change_by_id'), table_name='vote_activity')
    op.drop_index(op.f('ix_vote_activity_activity_title'), table_name='vote_activity')
    op.drop_table('vote_activity')
    # ### end Alembic commands ###
