From d9014638165e34e1ddd7d6267e81e8a6d6cd4024 Mon Sep 17 00:00:00 2001 From: Andres Jose Sebastian Rincon Gonzalez Date: Sun, 8 Sep 2024 16:16:54 -0500 Subject: [PATCH] [1802] adjust the code to support a different db schemas (#1803) --- backend/danswer/db/models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/danswer/db/models.py b/backend/danswer/db/models.py index 710880feaac..a3264a43765 100644 --- a/backend/danswer/db/models.py +++ b/backend/danswer/db/models.py @@ -61,7 +61,7 @@ class Base(DeclarativeBase): - pass + __abstract__ = True class EncryptedString(TypeDecorator): @@ -448,7 +448,7 @@ class Document(Base): ) tags = relationship( "Tag", - secondary="document__tag", + secondary=Document__Tag.__table__, back_populates="documents", ) @@ -465,7 +465,7 @@ class Tag(Base): documents = relationship( "Document", - secondary="document__tag", + secondary=Document__Tag.__table__, back_populates="tags", ) @@ -814,7 +814,7 @@ class SearchDoc(Base): chat_messages = relationship( "ChatMessage", - secondary="chat_message__search_doc", + secondary=ChatMessage__SearchDoc.__table__, back_populates="search_docs", ) @@ -957,7 +957,7 @@ class ChatMessage(Base): ) search_docs: Mapped[list["SearchDoc"]] = relationship( "SearchDoc", - secondary="chat_message__search_doc", + secondary=ChatMessage__SearchDoc.__table__, back_populates="chat_messages", ) # NOTE: Should always be attached to the `assistant` message.