Files
pear-admin-flask/migrations/versions/59add0790978_.py
T
2021-03-18 22:59:02 +08:00

97 lines
4.5 KiB
Python

"""empty message
Revision ID: 59add0790978
Revises:
Create Date: 2021-03-11 22:39:09.829159
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '59add0790978'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('admin_admin_log',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('method', sa.String(length=10), nullable=True),
sa.Column('uid', sa.Integer(), nullable=True),
sa.Column('url', sa.String(length=255), nullable=True),
sa.Column('desc', sa.Text(), nullable=True),
sa.Column('ip', sa.String(length=255), nullable=True),
sa.Column('user_agent', sa.Text(), nullable=True),
sa.Column('create_time', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('admin_photo',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('href', sa.String(length=255), nullable=True),
sa.Column('mime', sa.CHAR(length=50), nullable=False),
sa.Column('size', sa.CHAR(length=30), nullable=False),
sa.Column('create_time', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('admin_power',
sa.Column('id', sa.Integer(), nullable=False, comment='权限编号'),
sa.Column('name', sa.String(length=255), nullable=True, comment='权限名称'),
sa.Column('type', sa.String(length=1), nullable=True, comment='权限类型'),
sa.Column('code', sa.String(length=30), nullable=True, comment='权限标识'),
sa.Column('url', sa.String(length=255), nullable=True, comment='权限路径'),
sa.Column('open_type', sa.String(length=10), nullable=True, comment='打开方式'),
sa.Column('parent_id', sa.String(length=19), nullable=True, comment='父类编号'),
sa.Column('icon', sa.String(length=128), nullable=True, comment='图标'),
sa.Column('sort', sa.Integer(), nullable=True, comment='排序'),
sa.Column('create_time', sa.DateTime(), nullable=True, comment='创建时间'),
sa.Column('update_time', sa.DateTime(), nullable=True, comment='更新时间'),
sa.Column('enable', sa.Integer(), nullable=True, comment='是否开启'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('admin_role',
sa.Column('id', sa.Integer(), nullable=False, comment='角色ID'),
sa.Column('name', sa.String(length=255), nullable=True, comment='角色名称'),
sa.Column('code', sa.String(length=255), nullable=True, comment='角色标识'),
sa.Column('enable', sa.CHAR(length=1), nullable=True, comment='是否启用'),
sa.Column('remark', sa.String(length=255), nullable=True, comment='备注'),
sa.Column('details', sa.String(length=255), nullable=True, comment='详情'),
sa.Column('sort', sa.Integer(), nullable=True, comment='排序'),
sa.Column('create_time', sa.DateTime(), nullable=True, comment='创建时间'),
sa.Column('update_time', sa.DateTime(), nullable=True, comment='更新时间'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('admin_user',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='用户ID'),
sa.Column('username', sa.String(length=20), nullable=True, comment='用户名'),
sa.Column('password_hash', sa.String(length=128), nullable=True, comment='哈希密码'),
sa.Column('status', sa.Integer(), nullable=True, comment='启用'),
sa.Column('create_at', sa.DateTime(), nullable=True, comment='创建时间'),
sa.Column('update_at', sa.DateTime(), nullable=True, comment='创建时间'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('admin_user_role',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='标识'),
sa.Column('user_id', sa.Integer(), nullable=True, comment='用户编号'),
sa.Column('role_id', sa.Integer(), nullable=True, comment='角色编号'),
sa.ForeignKeyConstraint(['role_id'], ['admin_role.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['admin_user.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('admin_user_role')
op.drop_table('admin_user')
op.drop_table('admin_role')
op.drop_table('admin_power')
op.drop_table('admin_photo')
op.drop_table('admin_admin_log')
# ### end Alembic commands ###