增加数据字典

This commit is contained in:
mkg
2021-04-16 14:08:13 +08:00
parent a709095dc2
commit 2f0df0a700
24 changed files with 1284 additions and 431 deletions
-28
View File
@@ -1,28 +0,0 @@
"""empty message
Revision ID: 58fc2c4c30a5
Revises: 715a8ecc5856
Create Date: 2021-03-19 21:31:06.761526
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '58fc2c4c30a5'
down_revision = '715a8ecc5856'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('admin_role', sa.Column('enable', sa.Integer(), nullable=True, comment='是否启用'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('admin_role', 'enable')
# ### end Alembic commands ###
-28
View File
@@ -1,28 +0,0 @@
"""empty message
Revision ID: 64de3323bc01
Revises: 95b59a101b26
Create Date: 2021-03-18 20:54:17.724297
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '64de3323bc01'
down_revision = '95b59a101b26'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('admin_user', sa.Column('realname', sa.String(length=20), nullable=True, comment='真实名字'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('admin_user', 'realname')
# ### end Alembic commands ###
-28
View File
@@ -1,28 +0,0 @@
"""empty message
Revision ID: 715a8ecc5856
Revises: 64de3323bc01
Create Date: 2021-03-19 21:30:52.200812
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '715a8ecc5856'
down_revision = '64de3323bc01'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('admin_role', 'enable')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('admin_role', sa.Column('enable', mysql.CHAR(collation='utf8_unicode_ci', length=1), nullable=True, comment='是否启用'))
# ### end Alembic commands ###
-28
View File
@@ -1,28 +0,0 @@
"""empty message
Revision ID: 816f66c2def4
Revises: ce8825111f8f
Create Date: 2021-03-14 22:57:37.092157
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '816f66c2def4'
down_revision = 'ce8825111f8f'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('admin_admin_log', sa.Column('success', sa.Integer(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('admin_admin_log', 'success')
# ### end Alembic commands ###
-28
View File
@@ -1,28 +0,0 @@
"""empty message
Revision ID: 85fcf9a09800
Revises: e187b65f7f1b
Create Date: 2021-04-01 21:03:40.387739
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '85fcf9a09800'
down_revision = 'e187b65f7f1b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('admin_user', sa.Column('avatar', sa.String(length=255), nullable=True, comment='头像'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('admin_user', 'avatar')
# ### end Alembic commands ###
-30
View File
@@ -1,30 +0,0 @@
"""empty message
Revision ID: 95b59a101b26
Revises: 816f66c2def4
Create Date: 2021-03-17 22:28:41.595865
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '95b59a101b26'
down_revision = '816f66c2def4'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('admin_user', sa.Column('enable', sa.Integer(), nullable=True, comment='启用'))
op.drop_column('admin_user', 'status')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('admin_user', sa.Column('status', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True, comment='启用'))
op.drop_column('admin_user', 'enable')
# ### end Alembic commands ###
@@ -1,8 +1,8 @@
"""empty message
Revision ID: 59add0790978
Revision ID: 9a591b224cc7
Revises:
Create Date: 2021-03-11 22:39:09.829159
Create Date: 2021-04-16 10:13:27.930524
"""
from alembic import op
@@ -10,7 +10,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '59add0790978'
revision = '9a591b224cc7'
down_revision = None
branch_labels = None
depends_on = None
@@ -25,10 +25,33 @@ def upgrade():
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('success', sa.Integer(), 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_dict_data',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('data_label', sa.String(length=255), nullable=True, comment='字典类型名称'),
sa.Column('data_value', sa.String(length=255), nullable=True, comment='字典类型标识'),
sa.Column('type_code', sa.String(length=255), nullable=True, comment='字典类型描述'),
sa.Column('is_default', sa.Integer(), nullable=True, comment='是否默认'),
sa.Column('enable', sa.Integer(), nullable=True, comment='是否开启'),
sa.Column('remark', sa.String(length=255), 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_dict_type',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('type_name', sa.String(length=255), nullable=True, comment='字典类型名称'),
sa.Column('type_code', sa.String(length=255), nullable=True, comment='字典类型标识'),
sa.Column('description', sa.String(length=255), nullable=True, comment='字典类型描述'),
sa.Column('enable', 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_photo',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
@@ -45,7 +68,7 @@ def upgrade():
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('parent_id', sa.Integer(), 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='创建时间'),
@@ -57,7 +80,7 @@ def upgrade():
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('enable', sa.Integer(), 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='排序'),
@@ -68,12 +91,23 @@ def upgrade():
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('realname', sa.String(length=20), nullable=True, comment='真实名字'),
sa.Column('avatar', sa.String(length=255), nullable=True, comment='头像'),
sa.Column('remark', sa.String(length=255), nullable=True, comment='备注'),
sa.Column('password_hash', sa.String(length=128), nullable=True, comment='哈希密码'),
sa.Column('status', sa.Integer(), nullable=True, comment='启用'),
sa.Column('enable', 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_role_power',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='标识'),
sa.Column('power_id', sa.Integer(), nullable=True, comment='用户编号'),
sa.Column('role_id', sa.Integer(), nullable=True, comment='角色编号'),
sa.ForeignKeyConstraint(['power_id'], ['admin_power.id'], ),
sa.ForeignKeyConstraint(['role_id'], ['admin_role.id'], ),
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='用户编号'),
@@ -88,9 +122,12 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('admin_user_role')
op.drop_table('admin_role_power')
op.drop_table('admin_user')
op.drop_table('admin_role')
op.drop_table('admin_power')
op.drop_table('admin_photo')
op.drop_table('admin_dict_type')
op.drop_table('admin_dict_data')
op.drop_table('admin_admin_log')
# ### end Alembic commands ###
-35
View File
@@ -1,35 +0,0 @@
"""empty message
Revision ID: ce8825111f8f
Revises: 59add0790978
Create Date: 2021-03-11 22:41:25.156430
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ce8825111f8f'
down_revision = '59add0790978'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('admin_role_power',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='标识'),
sa.Column('power_id', sa.Integer(), nullable=True, comment='用户编号'),
sa.Column('role_id', sa.Integer(), nullable=True, comment='角色编号'),
sa.ForeignKeyConstraint(['power_id'], ['admin_power.id'], ),
sa.ForeignKeyConstraint(['role_id'], ['admin_role.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('admin_role_power')
# ### end Alembic commands ###
-28
View File
@@ -1,28 +0,0 @@
"""empty message
Revision ID: e187b65f7f1b
Revises: 58fc2c4c30a5
Create Date: 2021-04-01 21:03:04.872235
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e187b65f7f1b'
down_revision = '58fc2c4c30a5'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('admin_user', sa.Column('remark', sa.String(length=255), nullable=True, comment='备注'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('admin_user', 'remark')
# ### end Alembic commands ###