Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: judge table name prefix before migrate (#13094)

Lynnd938b4787700
diff --git a/common/doc_store/infinity_conn_base.py b/common/doc_store/infinity_conn_base.py
index 294192bd61..327f518f5a 100644
--- a/common/doc_store/infinity_conn_base.py
+++ b/common/doc_store/infinity_conn_base.py
@@ -33,12 +33,13 @@ from common.doc_store.doc_store_base import DocStoreConnection, MatchExpr, Order
class InfinityConnectionBase(DocStoreConnection):
- def __init__(self, mapping_file_name: str = "infinity_mapping.json", logger_name: str = "ragflow.infinity_conn"):
+ def __init__(self, mapping_file_name: str = "infinity_mapping.json", logger_name: str = "ragflow.infinity_conn", table_name_prefix: str="ragflow_"):
from common.doc_store.infinity_conn_pool import INFINITY_CONN
self.dbName = settings.INFINITY.get("db_name", "default_db")
self.mapping_file_name = mapping_file_name
self.logger = logging.getLogger(logger_name)
+ self.table_name_prefix = table_name_prefix
infinity_uri = settings.INFINITY["uri"]
if ":" in infinity_uri:
host, port = infinity_uri.split(":")
@@ -77,6 +78,9 @@ class InfinityConnectionBase(DocStoreConnection):
schema = json.load(f)
table_names = inf_db.list_tables().table_names
for table_name in table_names:
+ if not table_name.startswith(self.table_name_prefix):
+ # Skip tables not created by me
+ continue
inf_table = inf_db.get_table(table_name)
index_names = inf_table.list_indexes().index_names
if "q_vec_idx" not in index_names:
diff --git a/memory/utils/infinity_conn.py b/memory/utils/infinity_conn.py
index c7998542e3..826fbadfbe 100644
--- a/memory/utils/infinity_conn.py
+++ b/memory/utils/infinity_conn.py
@@ -30,7 +30,7 @@ from common.time_utils import date_string_to_timestamp
@singleton
class InfinityConnection(InfinityConnectionBase):
def __init__(self):
- super().__init__(mapping_file_name="message_infinity_mapping.json")
+ super().__init__(mapping_file_name="message_infinity_mapping.json", table_name_prefix="memory_")
"""
Dataframe and fields convert