Skip to content

Commit 0cbf061

Browse files
Aldo Ruiz Lunacursoragent
authored andcommitted
Fix ConnectedAccount crash: rename reserved SQLAlchemy metadata attribute.
SQLAlchemy Declarative API reserves `metadata`; map account_metadata to the existing `metadata` column so janua-api can boot with Coupler P1 models. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent fd9f2cf commit 0cbf061

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

apps/api/app/models/connected_account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ConnectedAccount(Base):
5454
oauth_expires_at = Column(DateTime, nullable=True)
5555

5656
status = Column(String(20), default=ConnectedAccountStatus.ACTIVE.value)
57-
metadata = Column(JSONB, default=dict)
57+
account_metadata = Column("metadata", JSONB, default=dict)
5858
last_used_at = Column(DateTime, nullable=True)
5959

6060
created_at = Column(DateTime, default=datetime.utcnow)

apps/api/app/services/connected_account_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ async def _sync_from_oauth_accounts(self, user: User) -> None:
122122
oauth_scopes=[],
123123
oauth_expires_at=oauth.token_expires_at,
124124
status=ConnectedAccountStatus.ACTIVE.value,
125-
metadata={"source": "oauth_account_sync"},
125+
account_metadata={"source": "oauth_account_sync"},
126126
created_by=user.id,
127127
)
128128
self.db.add(account)

0 commit comments

Comments
 (0)