generated from kgod/ai-review-template
自内部仓库剥离深度优化与 RAG 知识库后的交付版本: - Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强) - 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护 - 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏 - PostgreSQL 运行时 + Alembic 迁移链 Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
from app.db.sqlite_migration import migrate_sqlite_to_postgres
|
|
|
|
|
|
def main() -> None:
|
|
load_dotenv(Path(__file__).resolve().parents[1] / ".env", override=False)
|
|
parser = argparse.ArgumentParser(description="One-time SQLite to PostgreSQL Resume Agent migration")
|
|
parser.add_argument("source", type=Path, help="Path to the legacy SQLite database")
|
|
parser.add_argument("--database-url", default=os.getenv("DATABASE_URL"))
|
|
parser.add_argument("--schema", default="resume_agent")
|
|
parser.add_argument(
|
|
"--conflict-policy",
|
|
choices=("error", "update"),
|
|
default="error",
|
|
)
|
|
parser.add_argument("--dry-run", action="store_true")
|
|
args = parser.parse_args()
|
|
if not args.database_url:
|
|
parser.error("--database-url or DATABASE_URL is required")
|
|
report = migrate_sqlite_to_postgres(
|
|
args.source, args.database_url, schema=args.schema, dry_run=args.dry_run,
|
|
conflict_policy=args.conflict_policy,
|
|
)
|
|
print(report)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|