fix_graph_nodes_fk.sql 495 B

12345678910111213141516
  1. -- 修复 graph_nodes 表的外键约束问题
  2. -- user_id 不再需要外键约束,因为自动 NER 提取时没有用户上下文
  3. -- 删除 user_id 的外键约束
  4. ALTER TABLE graph_nodes DROP CONSTRAINT IF EXISTS fk_graph_nodes_user;
  5. -- 确认删除成功
  6. SELECT
  7. conname AS constraint_name,
  8. conrelid::regclass AS table_name
  9. FROM pg_constraint
  10. WHERE conrelid = 'graph_nodes'::regclass
  11. AND contype = 'f';
  12. -- 完成
  13. SELECT 'graph_nodes user_id 外键约束已移除' AS status;