파이썬(/appserver/apps/account/models.py)
# 생략
from sqlmodel import SQLModel, Field, Relationship, func, Column, AutoString
class User(SQLModel, table=True):
__tablename__ = "users"
# 생략
oauth_accounts: list[OAuthAccount] = Relationship(back_populates="user") # ①
class OAuthAccount(SQLModel, table=True):
__tablename__ = "oauth_accounts"
# 생략
user_id: int = Field(foreign_key="users.id")
user: User = Relationship(back_populates="oauth_accounts") # ②
User 모델의 oauth_accounts 모델 필드에 있는 Relationship에 back_populates="user"를 추가하고, 같은 방식으로 OAuthAccount의 user 모델 필드에도 반영했습니다(①).