修改数据库初始化逻辑,完善权限,废弃flaskenv
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 7634e028e338
|
||||
Revises: 8b664608a7c7
|
||||
Create Date: 2021-06-01 16:43:50.853692
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7634e028e338'
|
||||
down_revision = '8b664608a7c7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('admin_user', sa.Column('dept_id', sa.Integer(), nullable=True, comment='部门id'))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('admin_user', 'dept_id')
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,42 +0,0 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 8b664608a7c7
|
||||
Revises: ec21e19825ff
|
||||
Create Date: 2021-06-01 14:37:20.327189
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8b664608a7c7'
|
||||
down_revision = 'ec21e19825ff'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('admin_dept',
|
||||
sa.Column('id', sa.Integer(), nullable=False, comment='部门ID'),
|
||||
sa.Column('parent_id', sa.Integer(), nullable=True, comment='父级编号'),
|
||||
sa.Column('dept_name', sa.String(length=50), nullable=True, comment='部门名称'),
|
||||
sa.Column('sort', sa.Integer(), nullable=True, comment='排序'),
|
||||
sa.Column('leader', sa.String(length=50), nullable=True, comment='负责人'),
|
||||
sa.Column('phone', sa.String(length=20), nullable=True, comment='联系方式'),
|
||||
sa.Column('email', sa.String(length=50), nullable=True, comment='邮箱'),
|
||||
sa.Column('status', sa.Integer(), nullable=True, comment='状态(1开启,0关闭)'),
|
||||
sa.Column('remark', sa.Text(), nullable=True, comment='备注'),
|
||||
sa.Column('address', sa.String(length=255), nullable=True, comment='详细地址'),
|
||||
sa.Column('create_at', sa.DateTime(), nullable=True, comment='创建时间'),
|
||||
sa.Column('update_at', sa.DateTime(), nullable=True, comment='创建时间'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('admin_dept')
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,16 +1,16 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: ec21e19825ff
|
||||
Revision ID: b7a6be37d1f3
|
||||
Revises:
|
||||
Create Date: 2021-04-27 11:54:00.453274
|
||||
Create Date: 2023-04-06 00:18:14.996470
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ec21e19825ff'
|
||||
revision = 'b7a6be37d1f3'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@@ -30,6 +30,21 @@ def upgrade():
|
||||
sa.Column('create_time', sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('admin_dept',
|
||||
sa.Column('id', sa.Integer(), nullable=False, comment='部门ID'),
|
||||
sa.Column('parent_id', sa.Integer(), nullable=True, comment='父级编号'),
|
||||
sa.Column('dept_name', sa.String(length=50), nullable=True, comment='部门名称'),
|
||||
sa.Column('sort', sa.Integer(), nullable=True, comment='排序'),
|
||||
sa.Column('leader', sa.String(length=50), nullable=True, comment='负责人'),
|
||||
sa.Column('phone', sa.String(length=20), nullable=True, comment='联系方式'),
|
||||
sa.Column('email', sa.String(length=50), nullable=True, comment='邮箱'),
|
||||
sa.Column('status', sa.Integer(), nullable=True, comment='状态(1开启,0关闭)'),
|
||||
sa.Column('remark', sa.Text(), nullable=True, comment='备注'),
|
||||
sa.Column('address', sa.String(length=255), 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_dict_data',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('data_label', sa.String(length=255), nullable=True, comment='字典类型名称'),
|
||||
@@ -52,6 +67,15 @@ def upgrade():
|
||||
sa.Column('update_time', sa.DateTime(), nullable=True, comment='更新时间'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('admin_mail',
|
||||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='邮件编号'),
|
||||
sa.Column('receiver', sa.String(length=1024), nullable=True, comment='收件人邮箱'),
|
||||
sa.Column('subject', sa.String(length=128), nullable=True, comment='邮件主题'),
|
||||
sa.Column('content', sa.Text(), nullable=True, comment='邮件正文'),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True, comment='发送人id'),
|
||||
sa.Column('create_at', 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),
|
||||
@@ -96,6 +120,7 @@ def upgrade():
|
||||
sa.Column('remark', sa.String(length=255), nullable=True, comment='备注'),
|
||||
sa.Column('password_hash', sa.String(length=128), nullable=True, comment='哈希密码'),
|
||||
sa.Column('enable', sa.Integer(), nullable=True, comment='启用'),
|
||||
sa.Column('dept_id', sa.Integer(), nullable=True, comment='部门id'),
|
||||
sa.Column('create_at', sa.DateTime(), nullable=True, comment='创建时间'),
|
||||
sa.Column('update_at', sa.DateTime(), nullable=True, comment='创建时间'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
@@ -116,18 +141,35 @@ def upgrade():
|
||||
sa.ForeignKeyConstraint(['user_id'], ['admin_user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
with op.batch_alter_table('apscheduler_jobs', schema=None) as batch_op:
|
||||
batch_op.drop_index('ix_apscheduler_jobs_next_run_time')
|
||||
|
||||
op.drop_table('apscheduler_jobs')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('apscheduler_jobs',
|
||||
sa.Column('id', mysql.VARCHAR(length=191), nullable=False),
|
||||
sa.Column('next_run_time', mysql.DOUBLE(asdecimal=True), nullable=True),
|
||||
sa.Column('job_state', sa.BLOB(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_default_charset='utf8mb3',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('apscheduler_jobs', schema=None) as batch_op:
|
||||
batch_op.create_index('ix_apscheduler_jobs_next_run_time', ['next_run_time'], unique=False)
|
||||
|
||||
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_mail')
|
||||
op.drop_table('admin_dict_type')
|
||||
op.drop_table('admin_dict_data')
|
||||
op.drop_table('admin_dept')
|
||||
op.drop_table('admin_admin_log')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user