Skip to content

Commit

Permalink
fix: Add association table relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Nov 13, 2024
1 parent c1c349c commit b2abda9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ai/backend/manager/models/container_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import yarl
from graphql import Undefined, UndefinedType
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import load_only
from sqlalchemy.orm import load_only, relationship
from sqlalchemy.orm.exc import NoResultFound

from ai.backend.common.exception import UnknownImageRegistry
Expand Down Expand Up @@ -82,6 +82,12 @@ class ContainerRegistryRow(Base):
)
extra = sa.Column("extra", sa.JSON, nullable=True, default=None)

association_container_registries_groups_rows = relationship(
"AssociationContainerRegistriesGroupsRow",
back_populates="container_registry_row",
primaryjoin="ContainerRegistryRow.id == foreign(AssociationContainerRegistriesGroupsRow.registry_id)",
)

@classmethod
async def get(
cls,
Expand Down
5 changes: 5 additions & 0 deletions src/ai/backend/manager/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ class GroupRow(Base):
back_populates="group_row",
primaryjoin="GroupRow.id == foreign(VFolderRow.group)",
)
association_container_registries_groups_rows = relationship(
"AssociationContainerRegistriesGroupsRow",
back_populates="group_row",
primaryjoin="GroupRow.id == foreign(AssociationContainerRegistriesGroupsRow.group_id)",
)


@dataclass
Expand Down

0 comments on commit b2abda9

Please sign in to comment.