dify/knowledge-fs/packages/database/migrations
Jyong b79b8a879b feat(knowledge-fs): record and count every knowledge space query
Workflow KnowledgeFS retrieval nodes ran through `retrieval-tests`, which
never wrote an AnswerTrace or an overview event, so their queries were
missing from the retrieval history and from the space overview; the history
also only ever showed each member their own traces.

- AnswerTrace gains a `source` (retrieval_test | workflow | service_api |
  agent | mcp; migration 0051_answer_trace_source) derived from the
  Capability v2 caller kind. The retrieval-tests route records one trace per
  run (stages, evidence bundle, profile metadata), returns its id as
  `answerTraceId`, and the workflow node's failed-retrieval capture attaches
  to that trace instead of creating a second record.
- The quality trace list exposes and filters by `source`; traces from other
  caller kinds are visible to any current reader of the space, and counts and
  scores fall back to the evidence embedded in the trace when no bundle row
  exists.
- Overview accounting: retrieval-tests and Research tasks now emit
  `query.requested`, and the Research job state machine emits
  `query.completed` / `query.failed` on terminal stages (wired for both the
  in-process gateway and the durable runtime), so query volume, answer rate
  and outcomes include every caller. Activity details keep `source` and
  `taskKind`.
- Console and service trace routes accept a `source` filter; the retrieval
  test page shows a source badge and an all / retrieval tests / workflow
  filter, with translations for every locale.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-04 05:48:17 -04:00
..
0001_initial_schema.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0001_initial_schema.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0002_vector_index_upgrade.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0002_vector_index_upgrade.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0003_projection_set_publications.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0003_projection_set_publications.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0004_projection_publication_members.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0004_projection_publication_members.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0005_publication_generation_nonzero.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0005_publication_generation_nonzero.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0006_document_compilation_attempts.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0006_document_compilation_attempts.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0007_knowledge_node_generations.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0007_knowledge_node_generations.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0008_flattened_page_index.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0008_flattened_page_index.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0009_legacy_space_bootstrap.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0009_legacy_space_bootstrap.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0010_page_index_upgrade_backfill.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0010_page_index_upgrade_backfill.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0011_tidb_fts_postings.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0011_tidb_fts_postings.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0012_tidb_baseline_repair.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0012_tidb_baseline_repair.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0013_space_access_control.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0013_space_access_control.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0014_source_credential_refs.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0014_source_credential_refs.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0015_research_task_jobs.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0015_research_task_jobs.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0016_compilation_job_requester_binding.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0016_compilation_job_requester_binding.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0017_durable_deletion.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0017_durable_deletion.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0018_versioned_space_profiles.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0018_versioned_space_profiles.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0019_profile_publication_bindings.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0019_profile_publication_bindings.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0020_profile_migration_runs.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0020_profile_migration_runs.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0021_source_product_workflows.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0021_source_product_workflows.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0022_logical_document_revisions.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0022_logical_document_revisions.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0023_knowledge_space_overview.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0023_knowledge_space_overview.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0024_quality_control.postgres.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0024_quality_control.tidb.sql chore: migrate knowledge-fs source tree 2026-07-20 04:54:20 -04:00
0025_capability_grant_provenance.postgres.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0025_capability_grant_provenance.tidb.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0026_capability_job_provenance.postgres.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0026_capability_job_provenance.tidb.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0027_upload_sessions.postgres.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0027_upload_sessions.tidb.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0028_dify_integration_states.postgres.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0028_dify_integration_states.tidb.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0029_dify_integration_freezes.postgres.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0029_dify_integration_freezes.tidb.sql Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
0030_bulk_operations.postgres.sql Expand workflow features and update related components 2026-07-23 22:53:41 -04:00
0030_bulk_operations.tidb.sql Expand workflow features and update related components 2026-07-23 22:53:41 -04:00
0031_source_connection_capability_provenance.postgres.sql fix(dataset): complete New RAG connected source flows 2026-07-28 12:58:18 +08:00
0031_source_connection_capability_provenance.tidb.sql fix(dataset): complete New RAG connected source flows 2026-07-28 12:58:18 +08:00
0032_capability_source_sync_policies.postgres.sql fix(dataset): complete New RAG connected source flows 2026-07-28 12:58:18 +08:00
0032_capability_source_sync_policies.tidb.sql fix(dataset): complete New RAG connected source flows 2026-07-28 12:58:18 +08:00
0033_research_task_final_answers.postgres.sql Restore Research answer synthesis routing 2026-07-29 13:32:01 -04:00
0033_research_task_final_answers.tidb.sql Restore Research answer synthesis routing 2026-07-29 13:32:01 -04:00
0034_knowledge_space_emoji_icons.postgres.sql Support emoji icons and map Knowledge FS bad requests 2026-07-30 01:34:56 -04:00
0034_knowledge_space_emoji_icons.tidb.sql Support emoji icons and map Knowledge FS bad requests 2026-07-30 01:34:56 -04:00
0035_research_task_answer_streaming.postgres.sql Stream research task answer deltas through durable progress events 2026-08-02 12:45:51 -04:00
0035_research_task_answer_streaming.tidb.sql Stream research task answer deltas through durable progress events 2026-08-02 12:45:51 -04:00
0036_page_index_findability.postgres.sql Update application functionality and related components 2026-08-06 06:10:09 -04:00
0036_page_index_findability.tidb.sql Update application functionality and related components 2026-08-06 06:10:09 -04:00
0037_logical_document_zero_revision_deletion.postgres.sql fix(knowledge-fs): allow zero-revision logical document deletion 2026-08-06 18:49:11 +08:00
0037_logical_document_zero_revision_deletion.tidb.sql fix(knowledge-fs): allow zero-revision logical document deletion 2026-08-06 18:49:11 +08:00
0038_document_outline_summary_checkpoints.postgres.sql Refactor application components and update related functionality 2026-08-09 12:19:56 -04:00
0038_document_outline_summary_checkpoints.tidb.sql Refactor application components and update related functionality 2026-08-09 12:19:56 -04:00
0039_document_semantic_enrichment.postgres.sql Refactor application components and update related functionality 2026-08-09 12:19:56 -04:00
0039_document_semantic_enrichment.tidb.sql Refactor application components and update related functionality 2026-08-09 12:19:56 -04:00
0040_knowledge_space_metadata.postgres.sql feat(knowledge-fs): add durable metadata management 2026-08-10 02:55:09 -04:00
0040_knowledge_space_metadata.tidb.sql feat(knowledge-fs): add durable metadata management 2026-08-10 02:55:09 -04:00
0041_logical_document_availability.postgres.sql feat(knowledge_fs): add document availability management with bulk update support 2026-08-11 10:01:33 +08:00
0041_logical_document_availability.tidb.sql feat(knowledge_fs): add document availability management with bulk update support 2026-08-11 10:01:33 +08:00
0042_workflow_failed_retrieval_capture.postgres.sql feat: capture workflow retrieval misses 2026-08-12 13:31:02 -04:00
0042_workflow_failed_retrieval_capture.tidb.sql feat: capture workflow retrieval misses 2026-08-12 13:31:02 -04:00
0043_semantic_generation_receipts.postgres.sql restore semantic document compilation pipeline 2026-08-13 13:10:39 -04:00
0043_semantic_generation_receipts.tidb.sql restore semantic document compilation pipeline 2026-08-13 13:10:39 -04:00
0044_document_semantic_window_checkpoints.postgres.sql feat(knowledge-fs): optimize document ingestion pipeline 2026-08-17 02:40:21 -04:00
0044_document_semantic_window_checkpoints.tidb.sql feat(knowledge-fs): optimize document ingestion pipeline 2026-08-17 02:40:21 -04:00
0045_quality_replay_match_policy.postgres.sql feat(knowledge): add golden question evaluations 2026-08-19 05:54:05 -04:00
0045_quality_replay_match_policy.tidb.sql feat(knowledge): add golden question evaluations 2026-08-19 05:54:05 -04:00
0046_remove_provider_sync_policy.postgres.sql fix(knowledge-fs): remove provider mode from sync policies and update related constraints 2026-08-28 14:06:49 +08:00
0046_remove_provider_sync_policy.tidb.sql fix(knowledge-fs): remove provider mode from sync policies and update related constraints 2026-08-28 14:24:20 +08:00
0047_parse_artifact_checkpoints.postgres.sql perf(knowledge-fs): harden cross-format document ingestion 2026-08-31 07:48:35 -04:00
0047_parse_artifact_checkpoints.tidb.sql perf(knowledge-fs): harden cross-format document ingestion 2026-08-31 07:48:35 -04:00
0048_deletion_active_scope_indexes.postgres.sql fix(knowledge-fs): scope child deletion conflicts 2026-09-01 05:18:38 -04:00
0048_deletion_active_scope_indexes.tidb.sql fix(knowledge-fs): scope child deletion conflicts 2026-09-01 05:18:38 -04:00
0049_answer_trace_query_images.postgres.sql feat(knowledge-fs): keep query images with retrieval test history 2026-09-02 09:17:36 -04:00
0049_answer_trace_query_images.tidb.sql feat(knowledge-fs): keep query images with retrieval test history 2026-09-02 09:17:36 -04:00
0050_deletion_job_capability_provenance.postgres.sql fix(knowledge-fs): harden semantic chunking and deletion cleanup 2026-09-03 16:59:57 +08:00
0050_deletion_job_capability_provenance.tidb.sql fix(knowledge-fs): harden semantic chunking and deletion cleanup 2026-09-03 16:59:57 +08:00
0051_failed_query_trace_outcome_index.postgres.sql fix(knowledge-fs): persist durable query outcomes 2026-09-04 11:43:04 +08:00
0051_failed_query_trace_outcome_index.tidb.sql fix(knowledge-fs): persist durable query outcomes 2026-09-04 11:43:04 +08:00
0052_namespace_source_previews.postgres.sql feat(knowledge-fs): add namespace preview for initial website sources 2026-09-04 15:52:36 +08:00
0052_namespace_source_previews.tidb.sql feat(knowledge-fs): add namespace preview for initial website sources 2026-09-04 15:52:36 +08:00
0053_answer_trace_source.postgres.sql feat(knowledge-fs): record and count every knowledge space query 2026-09-04 05:48:17 -04:00
0053_answer_trace_source.tidb.sql feat(knowledge-fs): record and count every knowledge space query 2026-09-04 05:48:17 -04:00