From 55c9fc00174185a311f6a73e93beb73c05264672 Mon Sep 17 00:00:00 2001 From: He Wang Date: Mon, 5 Jan 2026 19:31:44 +0800 Subject: [PATCH] fix: add 'mom_id' column to OBConnection chunk table (#12444) ### What problem does this PR solve? Fix #12428 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/utils/ob_conn.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rag/utils/ob_conn.py b/rag/utils/ob_conn.py index d43f8bb75..d0099a81b 100644 --- a/rag/utils/ob_conn.py +++ b/rag/utils/ob_conn.py @@ -48,6 +48,7 @@ logger = logging.getLogger('ragflow.ob_conn') column_order_id = Column("_order_id", Integer, nullable=True, comment="chunk order id for maintaining sequence") column_group_id = Column("group_id", String(256), nullable=True, comment="group id for external retrieval") +column_mom_id = Column("mom_id", String(256), nullable=True, comment="parent chunk id") column_definitions: list[Column] = [ Column("id", String(256), primary_key=True, comment="chunk id"), @@ -92,6 +93,7 @@ column_definitions: list[Column] = [ Column("extra", JSON, nullable=True, comment="extra information of non-general chunk"), column_order_id, column_group_id, + column_mom_id, ] column_names: list[str] = [col.name for col in column_definitions] @@ -538,7 +540,7 @@ class OBConnection(DocStoreConnection): column_name = fts_column.split("^")[0] if not self._index_exists(table_name, fulltext_index_name_template % column_name): return False - for column in [column_order_id, column_group_id]: + for column in [column_order_id, column_group_id, column_mom_id]: if not self._column_exist(table_name, column.name): return False except Exception as e: @@ -592,7 +594,7 @@ class OBConnection(DocStoreConnection): ) # new columns migration - for column in [column_order_id, column_group_id]: + for column in [column_order_id, column_group_id, column_mom_id]: _try_with_lock( lock_name=f"ob_add_{column.name}_{indexName}", check_func=lambda: self._column_exist(indexName, column.name),