"""empty message

Revision ID: a1d0e6039115
Revises: 
Create Date: 2019-08-28 09:47:15.745503

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a1d0e6039115'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('bbs_category',
    sa.Column('cid', sa.Integer(), nullable=False),
    sa.Column('cname', sa.String(length=60), nullable=False),
    sa.Column('parentid', sa.Integer(), nullable=False),
    sa.Column('compere', sa.String(length=30), nullable=True),
    sa.Column('description', sa.String(length=1000), nullable=True),
    sa.Column('orderby', sa.Integer(), nullable=True),
    sa.Column('namestyle', sa.String(length=10), nullable=True),
    sa.Column('logo', sa.String(length=200), nullable=True),
    sa.Column('themenum', sa.Integer(), nullable=True),
    sa.Column('replynum', sa.Integer(), nullable=True),
    sa.Column('lastpost', sa.String(length=600), nullable=True),
    sa.PrimaryKeyConstraint('cid')
    )
    op.create_table('bbs_friendlink',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('site', sa.String(length=100), nullable=False),
    sa.Column('url', sa.String(length=200), nullable=True),
    sa.Column('logo', sa.String(length=300), nullable=True),
    sa.Column('orderby', sa.Integer(), nullable=True),
    sa.Column('description', sa.String(length=300), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('bbs_lockip',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('ip', sa.String(length=20), nullable=False),
    sa.Column('starttime', sa.DateTime(), nullable=True),
    sa.Column('endtime', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('bbs_siteinfo',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('sitename', sa.String(length=100), nullable=True),
    sa.Column('website', sa.String(length=100), nullable=True),
    sa.Column('url', sa.String(length=200), nullable=True),
    sa.Column('reference', sa.String(length=200), nullable=True),
    sa.Column('isclose', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('bbs_user',
    sa.Column('uid', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('username', sa.String(length=32), nullable=False),
    sa.Column('password', sa.String(length=128), nullable=False),
    sa.Column('portrait', sa.String(length=100), nullable=True),
    sa.Column('gender', sa.Integer(), nullable=True),
    sa.Column('usertype', sa.Integer(), nullable=True),
    sa.Column('isactive', sa.Integer(), nullable=True),
    sa.Column('email', sa.String(length=200), nullable=True),
    sa.Column('autologin', sa.Integer(), nullable=True),
    sa.Column('regtime', sa.DateTime(), nullable=True),
    sa.Column('score', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('uid'),
    sa.UniqueConstraint('username')
    )
    op.create_table('bbs_posts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=600), nullable=False),
    sa.Column('content', sa.Text(), nullable=True),
    sa.Column('hits', sa.Integer(), nullable=False),
    sa.Column('istop', sa.Integer(), nullable=False),
    sa.Column('iselite', sa.Integer(), nullable=False),
    sa.Column('ishot', sa.Integer(), nullable=False),
    sa.Column('price', sa.Integer(), nullable=False),
    sa.Column('isdel', sa.SmallInteger(), nullable=False),
    sa.Column('cid', sa.Integer(), nullable=True),
    sa.Column('uid', sa.Integer(), nullable=True),
    sa.Column('publishtime', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['cid'], ['bbs_category.cid'], ),
    sa.ForeignKeyConstraint(['uid'], ['bbs_user.uid'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('bbs_userdetail',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('birthday', sa.Date(), nullable=True),
    sa.Column('address', sa.String(length=200), nullable=True),
    sa.Column('qq', sa.String(length=15), nullable=True),
    sa.Column('signature', sa.String(length=200), nullable=True),
    sa.Column('quesstion', sa.String(length=100), nullable=True),
    sa.Column('answer', sa.String(length=200), nullable=True),
    sa.Column('grade', sa.String(length=100), nullable=True),
    sa.Column('uid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['uid'], ['bbs_user.uid'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('bbs_order',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('money', sa.Integer(), nullable=False),
    sa.Column('paytime', sa.DateTime(), nullable=True),
    sa.Column('uid', sa.Integer(), nullable=True),
    sa.Column('tid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['tid'], ['bbs_posts.id'], ),
    sa.ForeignKeyConstraint(['uid'], ['bbs_user.uid'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('bbs_reply',
    sa.Column('rid', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('content', sa.String(length=1000), nullable=True),
    sa.Column('istop', sa.Integer(), nullable=True),
    sa.Column('isdel', sa.SmallInteger(), nullable=True),
    sa.Column('isblock', sa.SmallInteger(), nullable=True),
    sa.Column('createtime', sa.DateTime(), nullable=True),
    sa.Column('uid', sa.Integer(), nullable=True),
    sa.Column('tid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['tid'], ['bbs_posts.id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['uid'], ['bbs_user.uid'], ),
    sa.PrimaryKeyConstraint('rid')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('bbs_reply')
    op.drop_table('bbs_order')
    op.drop_table('bbs_userdetail')
    op.drop_table('bbs_posts')
    op.drop_table('bbs_user')
    op.drop_table('bbs_siteinfo')
    op.drop_table('bbs_lockip')
    op.drop_table('bbs_friendlink')
    op.drop_table('bbs_category')
    # ### end Alembic commands ###
