Skip to content

修复知识库删除后无法重建同名#2

Open
StephenQiu30 wants to merge 1 commit intomainfrom
stephen/docs-sorting-chinese-pr
Open

修复知识库删除后无法重建同名#2
StephenQiu30 wants to merge 1 commit intomainfrom
stephen/docs-sorting-chinese-pr

Conversation

@StephenQiu30
Copy link
Copy Markdown
Owner

改动说明

  • 修复知识库创建接口在数据库唯一约束冲突时返回“知识库名称已存在”,避免前端展示泛化的“系统错误”
  • 更新 knowledge_base 表的唯一索引定义为 (name, is_delete),支持逻辑删除后重建同名知识库
  • 补充 SQL 说明和控制器回归测试,覆盖唯一约束冲突场景

问题根因

  • 现有知识库删除采用逻辑删除,旧记录会保留在 knowledge_base 表中
  • 业务层名称唯一性校验会忽略逻辑删除数据,因此预校验可以通过
  • 数据库层原本仍使用 name 单列唯一索引,导致同名重建在插入阶段失败,并被兜底成“系统错误”

验证

  • mvn -pl algorithm-service/algorithm-ai-service -am test -Dtest=KnowledgeBaseControllerTest -Dsurefire.failIfNoSpecifiedTests=false

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 15, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant