From adb4c2f845ef49e341644eb8be38ff59688d6387 Mon Sep 17 00:00:00 2001 From: arkohut <39525455+arkohut@users.noreply.github.com> Date: Fri, 7 Jun 2024 19:52:55 +0800 Subject: [PATCH] fix(plugin): wrong mapping with lib --- memos/models.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/memos/models.py b/memos/models.py index 9838f16..249bfda 100644 --- a/memos/models.py +++ b/memos/models.py @@ -32,7 +32,7 @@ class LibraryModel(Base): "FolderModel", back_populates="library", lazy="joined" ) plugins: Mapped[List["PluginModel"]] = relationship( - "LibraryPluginModel", back_populates="library", lazy="joined" + "PluginModel", secondary="library_plugins", lazy="joined" ) @@ -111,7 +111,6 @@ class PluginModel(Base): name: Mapped[str] = mapped_column(String, nullable=False) description: Mapped[str | None] = mapped_column(Text, nullable=True) webhook_url: Mapped[str] = mapped_column(String, nullable=False) - libraries = relationship("LibraryPluginModel", back_populates="plugin") class LibraryPluginModel(Base): @@ -122,12 +121,7 @@ class LibraryPluginModel(Base): plugin_id: Mapped[int] = mapped_column( Integer, ForeignKey("plugins.id"), nullable=False ) - library: Mapped["LibraryModel"] = relationship( - "LibraryModel", back_populates="plugins" - ) - plugin: Mapped["PluginModel"] = relationship( - "PluginModel", back_populates="libraries" - ) + # Create the database engine with the path from config