V20261117_04__remove_legacy_tables.sql 1.7 KB

12345678910111213141516171819202122232425262728293031323334
  1. -- ============================================================================
  2. -- ops 迁移版本:V20261117_04
  3. -- 源脚本:sql/remove_legacy_tables_20261117.sql
  4. -- 说明:由 deploy/ops/db.sh 按版本顺序执行;已执行过的文件请勿再修改。
  5. -- ============================================================================
  6. -- ============================================================================
  7. -- 清理已下线遗留模块的数据库表(2026-11-17)
  8. --
  9. -- 下线范围:
  10. -- 1) module/knowledge(旧知识库)——已由 ai_knowledge_base / ai_document 取代;
  11. -- 2) module/attachment(旧对话附件)——已由 ai_message_attachment / 新 AI 附件链路取代;
  12. -- 3) 无任何代码引用的历史表:meta_raw_file / meta_raw_sheet / rag_index_status /
  13. -- rag_ws78431654_d1024。
  14. --
  15. -- 说明:
  16. -- - 执行前请确认没有外部旧客户端仍调用 /knowledge-bases 等已删除接口;
  17. -- - 本脚本只删表,不清理旧文档文件与旧附件文件(已随代码清理手工删除)。
  18. -- ============================================================================
  19. drop table if exists knowledge_base cascade;
  20. drop table if exists knowledge_doc cascade;
  21. drop table if exists knowledge_doc_download_log cascade;
  22. drop table if exists kb_vec_1_bge_m3_d1024 cascade;
  23. drop table if exists kb_vec_1_d1024 cascade;
  24. drop table if exists kb_vec_2117247642917994497_bge_m3_d1024 cascade;
  25. drop table if exists kb_vec_2117254846962286594_bge_m3_d1024 cascade;
  26. drop table if exists chat_attachment cascade;
  27. drop table if exists meta_raw_file cascade;
  28. drop table if exists meta_raw_sheet cascade;
  29. drop table if exists rag_index_status cascade;
  30. drop table if exists rag_ws78431654_d1024 cascade;