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