"""empty message

Revision ID: 457763cef7cd
Revises: 
Create Date: 2017-01-13 15:26:48.775009

"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('first_classifications',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('一级分类名', sa.Unicode(length=255), nullable=True),
    sa.Column('创建时间', sa.DateTime(), nullable=True),
    sa.Column('修改时间', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('littleclouds',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('小云平台名称', sa.Unicode(length=255), nullable=True),
    sa.Column('小云平台URL', sa.String(length=255), nullable=True),
    sa.Column('是否允许接入', sa.Boolean(), nullable=True),
    sa.Column('是否已经接入', sa.Boolean(), nullable=True),
    sa.Column('联系电话', sa.String(length=30), nullable=True),
    sa.Column('联系邮箱', sqlalchemy_utils.types.email.EmailType(length=255), nullable=True),
    sa.Column('接入IP', sqlalchemy_utils.types.ip_address.IPAddressType(length=50), nullable=True),
    sa.Column('接入端口', sa.Integer(), nullable=True),
    sa.Column('接入协议', sa.String(length=20), nullable=True),
    sa.Column('创建时间', sa.DateTime(), nullable=True),
    sa.Column('修改时间', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('小云平台URL'),
    sa.UniqueConstraint('小云平台名称')
    )
    op.create_table('packages',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('文件名', sa.Unicode(length=255), nullable=True),
    sa.Column('文件总大小', sa.Integer(), nullable=True),
    sa.Column('MD5', sa.String(length=255), nullable=True),
    sa.Column('创建时间', sa.DateTime(), nullable=True),
    sa.Column('修改时间', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('文件名')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('用户名', sa.String(length=50), nullable=True),
    sa.Column('邮箱', sa.String(length=120), nullable=True),
    sa.Column('哈希加密密码', sa.String(length=128), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('用户名')
    )
    op.create_table('secondary_classifications',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('二级分类名', sa.Unicode(length=255), nullable=True),
    sa.Column('first_classification', sa.Integer(), nullable=True),
    sa.Column('创建时间', sa.DateTime(), nullable=True),
    sa.Column('修改时间', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['first_classification'], ['first_classifications.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('functions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('功能名', sa.Unicode(length=255), nullable=True),
    sa.Column('secondary_classification', sa.Integer(), nullable=True),
    sa.Column('创建时间', sa.DateTime(), nullable=True),
    sa.Column('修改时间', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['secondary_classification'], ['secondary_classifications.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('功能名')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('functions')
    op.drop_table('secondary_classifications')
    op.drop_table('users')
    op.drop_table('packages')
    op.drop_table('littleclouds')
    op.drop_table('first_classifications')
    # ### end Alembic commands ###
