"""empty message

Revision ID: be532c3c438d
Revises: 97a1a95524cc
Create Date: 2020-10-28 18:33:57.663109

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('wechat_subscriber',
    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('openid', sa.String(length=50), nullable=False, comment='微信openId'),
    sa.Column('union_id', sa.String(length=100), nullable=True, comment='订阅者唯一的id'),
    sa.Column('wachet_no', sa.String(length=100), nullable=True, comment='微信号'),
    sa.Column('nickname', sa.String(length=100), nullable=True, comment='微信名'),
    sa.Column('sex', sa.SmallInteger(), nullable=True, comment='性别, 0为未知,1为男,2为女'),
    sa.Column('province', sa.String(length=100), nullable=True, comment='省份'),
    sa.Column('city', sa.String(length=100), nullable=True, comment='城市'),
    sa.Column('country', sa.String(length=100), nullable=True, comment='国家'),
    sa.Column('head_img_url', sa.String(length=1300), nullable=True, comment='头像'),
    sa.Column('privilege', sa.String(length=100), nullable=True, comment='特权'),
    sa.Column('subscribed', sa.Boolean(), nullable=True, comment='目前已取消关注'),
    sa.Column('subscribe_time', sa.DateTime(), nullable=True, comment='关注时间'),
    sa.Column('unsubscribe_time', sa.DateTime(), nullable=True, comment='取消关注时间'),
    sa.Column('latitude', sa.String(length=20), nullable=True, comment='纬度'),
    sa.Column('longitude', sa.String(length=20), nullable=True, comment='经度'),
    sa.Column('precision', sa.String(length=20), nullable=True, comment='精度'),
    sa.Column('tags', sa.String(length=100), nullable=True, comment='标签'),
    sa.Column('points', sa.Integer(), nullable=True, comment='微信卡券积分'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_index(op.f('ix_wechat_subscriber_change_by_id'), 'wechat_subscriber', ['change_by_id'], unique=False)
    op.create_index(op.f('ix_wechat_subscriber_create_by_id'), 'wechat_subscriber', ['create_by_id'], unique=False)
    op.create_index(op.f('ix_wechat_subscriber_deleted_by_id'), 'wechat_subscriber', ['deleted_by_id'], unique=False)
    op.create_index(op.f('ix_wechat_subscriber_state'), 'wechat_subscriber', ['state'], unique=False)
    op.add_column('vote_activity', sa.Column('approval_result', sa.SmallInteger(), nullable=False, comment='审核结果::0未审核，1审核通过，2审核不通过'))
    op.add_column('vote_activity', sa.Column('approval_time', sa.DateTime(), nullable=True, comment='时间'))
    op.add_column('vote_activity', sa.Column('approval_user_id', sa.String(length=20), nullable=True, comment='审核用户id'))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('vote_activity', 'approval_user_id')
    op.drop_column('vote_activity', 'approval_time')
    op.drop_column('vote_activity', 'approval_result')
    op.drop_index(op.f('ix_wechat_subscriber_state'), table_name='wechat_subscriber')
    op.drop_index(op.f('ix_wechat_subscriber_deleted_by_id'), table_name='wechat_subscriber')
    op.drop_index(op.f('ix_wechat_subscriber_create_by_id'), table_name='wechat_subscriber')
    op.drop_index(op.f('ix_wechat_subscriber_change_by_id'), table_name='wechat_subscriber')
    op.drop_table('wechat_subscriber')
    # ### end Alembic commands ###
