Files
data-ge/file/tableschema/rag_snippet.sql
2025-12-09 00:15:22 +08:00

16 lines
1011 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE `rag_snippet` (
`rag_item_id` bigint NOT NULL COMMENT 'RAG item id (stable hash of table/version/snippet_id)',
`workspace_id` bigint NOT NULL COMMENT 'RAG workspace scope',
`table_id` bigint NOT NULL COMMENT '来源表ID',
`version_ts` bigint NOT NULL COMMENT '表版本号',
`action_result_id` bigint NOT NULL COMMENT '来源 action_results 主键IDsnippet_alias 或 snippet 行)',
`snippet_id` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '原始 snippet id',
`rag_text` text COLLATE utf8mb4_bin NOT NULL COMMENT '用于向量化的拼接文本',
`merged_json` json NOT NULL COMMENT '合并后的 snippet 对象',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`rag_item_id`),
KEY `idx_action_result` (`action_result_id`),
KEY `idx_workspace` (`workspace_id`),
KEY `idx_table_version` (`table_id`,`version_ts`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='RAG snippet 索引缓存';