File tree Expand file tree Collapse file tree
src/workflows_mcp/engine/knowledge Expand file tree Collapse file tree Original file line number Diff line number Diff line change 255255 SELECT 1 FROM information_schema.columns
256256 WHERE table_name = 'knowledge_propositions' AND column_name = 'source_type'
257257 ) THEN
258- ALTER TABLE knowledge_propositions ADD COLUMN source_type VARCHAR(50) DEFAULT 'DOCUMENT' ;
258+ ALTER TABLE knowledge_propositions ADD COLUMN source_type VARCHAR(50) DEFAULT NULL ;
259259 END IF;
260260 END $$;
261261
318318 END $$;
319319 """ ,
320320 ),
321+ (
322+ 7 ,
323+ "Clarify knowledge_propositions.source_type semantics: drop misleading default, null-out stale values" ,
324+ """
325+ DO $$
326+ BEGIN
327+ -- Drop the misleading DEFAULT 'DOCUMENT' — source_type must be set explicitly by callers.
328+ -- NULL means "origin unknown" (rows inserted before this was tracked correctly).
329+ ALTER TABLE knowledge_propositions
330+ ALTER COLUMN source_type DROP DEFAULT;
331+
332+ -- Null out the old heuristic values (DOCUMENT/TOOL were derived from source/path
333+ -- presence, not from actual ingestion origin — they are semantically meaningless).
334+ UPDATE knowledge_propositions SET source_type = NULL
335+ WHERE source_type IN ('DOCUMENT', 'TOOL');
336+ END $$;
337+ """ ,
338+ ),
321339]
322340
323341SCHEMA_VERSION = MIGRATIONS [- 1 ][0 ] if MIGRATIONS else 0
You can’t perform that action at this time.
0 commit comments