You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"""Initial migration
Revision ID: 67902ab783bc
Revises: b1465436c340
Create Date: 2025-03-03 21:19:33.592231
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '67902ab783bc'
down_revision = 'b1465436c340'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tb_emp', schema=None) as batch_op:
batch_op.drop_index('username')
op.drop_table('tb_emp')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tb_emp',
sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False, comment='主键'),
sa.Column('username', mysql.VARCHAR(length=20), nullable=False, comment='用户名'),
sa.Column('password', mysql.VARCHAR(length=32), server_default=sa.text("'123456'"), nullable=True, comment='密码'),
sa.Column('emp_name', mysql.VARCHAR(length=10), nullable=False, comment='员工姓名'),
sa.Column('gender', mysql.TINYINT(unsigned=True), autoincrement=False, nullable=False, comment='性别1 男生 2 女生)'),
sa.Column('image', mysql.VARCHAR(length=300), nullable=True, comment='图片的访问路径'),
sa.Column('job', mysql.TINYINT(unsigned=True), autoincrement=False, nullable=True, comment='职位1 班主任 2 讲师 3 学工主管 4 教研主管)'),
sa.Column('entrydate', mysql.DATETIME(), nullable=True, comment='入职日期'),
sa.Column('dept', mysql.VARCHAR(length=20), nullable=True, comment='归属部门'),
sa.Column('create_time', mysql.DATETIME(), nullable=False, comment='创建时间'),
sa.Column('update_time', mysql.DATETIME(), nullable=False, comment='更新时间'),
sa.PrimaryKeyConstraint('id'),
mysql_collate='utf8mb4_0900_ai_ci',
mysql_default_charset='utf8mb4',
mysql_engine='InnoDB'
)
with op.batch_alter_table('tb_emp', schema=None) as batch_op:
batch_op.create_index('username', ['username'], unique=True)
# ### end Alembic commands ###