
ConPort数据库迁移全攻略从v0.1.x升级到v0.2.4的安全操作指南【免费下载链接】context-portalContext Portal (ConPort): A memory bank MCP server building a project-specific knowledge graph to supercharge AI assistants. Enables powerful Retrieval Augmented Generation (RAG) for context-aware development in your IDE.项目地址: https://gitcode.com/gh_mirrors/co/context-portalContext Portal (ConPort) 是一个为AI助手构建项目特定知识图谱的内存库MCP服务器通过强大的检索增强生成RAG技术提升IDE中的上下文感知开发体验。本指南将帮助您安全、高效地完成从v0.1.x到v0.2.4版本的数据库迁移确保数据完整性和系统稳定性。 为什么需要数据库迁移v0.2.4版本引入了Alembic数据库迁移工具和CustomData时间戳字段等关键更新解决了旧版本中数据处理不一致、手动配置复杂等问题。根据RELEASE_NOTES.md此次升级显著提升了数据库迁移的健壮性和可靠性通过自动化Alembic配置简化了服务器设置流程。图ConPort数据库迁移流程的抽象表示展示了数据从旧版本到新版本的安全过渡 确定您的升级路径自动迁移适用情况当前版本为v0.1.9可直接通过Alembic自动处理 schema 变更新工作区首次安装v0.2.4时系统会自动在工作区根目录生成alembic.ini和context_portal/目录手动迁移必要情况版本低于v0.1.9如v0.1.6、v0.1.7、v0.1.8必须执行数据导出/导入自动迁移失败日志中出现数据库相关错误时多工作区管理每个包含context.db的项目需单独处理️ 快速迁移步骤TLDR自动迁移v0.1.9用户停止所有ConPort进程卸载旧版本uv pip uninstall context-portal-mcp安装新版本uv pip install context-portal-mcp重启服务器Alembic将自动应用迁移检查logs/conport.log确认无错误手动迁移v0.1.8及更早版本停止所有ConPort进程并确认终止导出数据通过AI助手执行export_conport_to_markdown卸载旧版本并清理残留文件删除context_portal/context.db安装新版本uv pip install context-portal-mcp复制alembic.ini到工作区根目录重启服务器生成新数据库导入数据通过AI助手执行import_markdown_to_conport 详细迁移指南1. 前期准备清理环境在进行任何数据库操作前需清除旧的编译文件以避免冲突Linux/macOS:find . -name __pycache__ -type d -exec rm -rf {} find . -name *.pyc -deleteWindows:for /d /r . %d in (__pycache__) do rd /s /q %d del /s /q *.pyc以上命令需在项目工作区根目录执行2. 自动迁移完整流程v0.1.9用户步骤1停止ConPort进程Linux/macOS:ps aux | grep context_portal_mcp.main # 查找进程ID kill PID # 终止进程必要时使用kill -9 PIDWindows:wmic process where namepython.exe get CommandLine,ProcessId taskkill /PID PID /F步骤2更新软件包uv pip uninstall context-portal-mcp uv pip install context-portal-mcp步骤3验证迁移结果启动服务器后检查日志文件cat logs/conport.log | grep -i migration成功迁移会显示类似Alembic migrations applied successfully的信息3. 手动迁移完整流程v0.1.8及更早版本步骤1-2停止进程并导出数据同自动迁移步骤1然后通过AI助手导出数据use_mcp_tool server_nameconport/server_name tool_nameexport_conport_to_markdown/tool_name arguments { workspace_id: ${workspaceFolder}, output_path: conport_backup } /arguments /use_mcp_tool步骤3-4卸载旧版本并删除数据库uv pip uninstall context-portal-mcp rm ./context_portal/context.db # Linux/macOS # del %CD%\context_portal\context.db # Windows步骤5-6安装新版本并配置Alembicuv pip install context-portal-mcp # 复制alembic.ini到工作区根目录Linux/macOS示例 cp /path/to/venv/lib/pythonX.Y/site-packages/context_portal_mcp/templates/alembic/alembic.ini ./步骤7-8重启服务器并导入数据启动服务器后通过AI助手导入数据use_mcp_tool server_nameconport/server_name tool_nameimport_markdown_to_conport/tool_name arguments { workspace_id: ${workspaceFolder}, input_path: conport_backup } /arguments /use_mcp_tool⚠️ 常见问题与解决方案Q1: 迁移后数据丢失怎么办A:检查conport_backup目录是否完整重新执行导入步骤。根据v0.2.4_UPDATE_GUIDE.mdv0.2.4的UTF-8导出功能已修复字符编码问题。Q2: Alembic报错script_location not foundA:确保alembic.ini已复制到工作区根目录且配置正确指向context_portal_mcp的Alembic脚本位置。Q3: 多工作区如何批量迁移A:软件包更新只需执行一次但每个工作区需单独完成数据导出/导入。建议使用独特的备份目录名称如conport_backup_projectA避免混淆。 参考资料v0.2.4更新指南发布说明ConPort MCP深度解析通过遵循本指南您可以安全地完成ConPort数据库迁移充分利用新版本带来的稳定性提升和功能增强。如有其他问题请查阅项目文档或联系技术支持。【免费下载链接】context-portalContext Portal (ConPort): A memory bank MCP server building a project-specific knowledge graph to supercharge AI assistants. Enables powerful Retrieval Augmented Generation (RAG) for context-aware development in your IDE.项目地址: https://gitcode.com/gh_mirrors/co/context-portal创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考