"""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')
