Files
012-kaopeilian/backend/migrations/versions/add_position_skills_level.py
111 998211c483 feat: 初始化考培练系统项目
- 从服务器拉取完整代码
- 按框架规范整理项目结构
- 配置 Drone CI 测试环境部署
- 包含后端(FastAPI)、前端(Vue3)、管理端

技术栈: Vue3 + TypeScript + FastAPI + MySQL
2026-01-24 19:33:28 +08:00

36 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Add skills and level fields to positions table
Revision ID: add_position_skills_level
Revises: 0487635b5e95
Create Date: 2025-09-22 09:00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'add_position_skills_level'
down_revision = '0487635b5e95'
branch_labels = None
depends_on = None
def upgrade():
"""添加skills和level字段到positions表"""
# 添加skills字段JSON类型存储技能数组
op.add_column('positions', sa.Column('skills', sa.JSON, nullable=True, comment='核心技能'))
# 添加level字段岗位等级
op.add_column('positions', sa.Column('level', sa.String(20), nullable=True, comment='岗位等级: junior/intermediate/senior/expert'))
# 添加sort_order字段排序
op.add_column('positions', sa.Column('sort_order', sa.Integer, nullable=True, default=0, comment='排序'))
def downgrade():
"""移除添加的字段"""
op.drop_column('positions', 'skills')
op.drop_column('positions', 'level')
op.drop_column('positions', 'sort_order')