From f1716a0fc05f2b7403c7c22617c5e93ab8f3eac5 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 19 Feb 2026 04:48:07 +0000 Subject: [PATCH] Add extend_existing=True to MenuNode and ContainerRelation models Prevents SQLAlchemy 'table already defined' error if the table gets registered by a stale glue submodule or cached Docker layer before the shared model is loaded. Co-Authored-By: Claude Opus 4.6 --- models/container_relation.py | 1 + models/menu_node.py | 1 + 2 files changed, 2 insertions(+) diff --git a/models/container_relation.py b/models/container_relation.py index ecafaba..986e177 100644 --- a/models/container_relation.py +++ b/models/container_relation.py @@ -15,6 +15,7 @@ class ContainerRelation(Base): ), Index("ix_container_relations_parent", "parent_type", "parent_id"), Index("ix_container_relations_child", "child_type", "child_id"), + {"extend_existing": True}, ) id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) diff --git a/models/menu_node.py b/models/menu_node.py index d4b49cc..b50b7ce 100644 --- a/models/menu_node.py +++ b/models/menu_node.py @@ -11,6 +11,7 @@ class MenuNode(Base): __table_args__ = ( Index("ix_menu_nodes_container", "container_type", "container_id"), Index("ix_menu_nodes_parent_id", "parent_id"), + {"extend_existing": True}, ) id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)