Files
resume-agent/backend/alembic/versions/20260730_05_optimization_runs.py
T
hypandClaude ae2d9b128d feat: builder 简历生成 + 轻度优化 + 简历导入交付副本
自内部仓库剥离深度优化与 RAG 知识库后的交付版本:
- Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强)
- 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护
- 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏
- PostgreSQL 运行时 + Alembic 迁移链

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-05 11:08:30 +08:00

43 lines
1.3 KiB
Python

"""Add durable optimization workflow state to PostgreSQL."""
from __future__ import annotations
from alembic import op
revision = "20260730_05"
down_revision = "20260724_03"
branch_labels = None
depends_on = None
def upgrade() -> None:
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
bind = op.get_bind()
bind.exec_driver_sql(
f'''
CREATE TABLE IF NOT EXISTS "{schema}".optimization_runs (
id VARCHAR(128) PRIMARY KEY,
session_id VARCHAR(128) NOT NULL
REFERENCES "{schema}".sessions(id) ON DELETE CASCADE,
entry_id VARCHAR(128) NOT NULL,
mode VARCHAR(32) NOT NULL,
status VARCHAR(32) NOT NULL,
source_revision INTEGER NOT NULL CHECK (source_revision >= 1),
state JSONB NOT NULL,
proposal JSONB,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL
)
'''
)
bind.exec_driver_sql(
f'''CREATE INDEX IF NOT EXISTS ix_optimization_runs_active
ON "{schema}".optimization_runs (session_id, entry_id, status)'''
)
def downgrade() -> None:
schema = op.get_context().config.get_main_option("resume_agent.schema", "resume_agent")
op.get_bind().exec_driver_sql(f'DROP TABLE IF EXISTS "{schema}".optimization_runs')