제공자 키 저장 쿼리 충돌 수정
Some checks failed
API contract / OpenAPI type drift (push) Failing after 54s

This commit is contained in:
Yun Chan 2026-09-22 22:53:18 +09:00
parent 84e33024a7
commit d58eb67764
2 changed files with 58 additions and 4 deletions

View file

@ -340,7 +340,7 @@ async def save_credential(
async with pool.acquire() as conn:
row = await conn.fetchrow(
"""
INSERT INTO app.admin_provider_credential (
INSERT INTO app.admin_provider_credential AS existing (
provider, token_encrypted, token_hint, auth_kind, updated_by, updated_at,
refresh_token_encrypted, extra
)
@ -351,8 +351,14 @@ async def save_credential(
auth_kind = EXCLUDED.auth_kind,
updated_by = EXCLUDED.updated_by,
updated_at = now(),
refresh_token_encrypted = COALESCE(EXCLUDED.refresh_token_encrypted, refresh_token_encrypted),
extra = CASE WHEN EXCLUDED.extra::text = '{}'::jsonb THEN extra ELSE EXCLUDED.extra END,
refresh_token_encrypted = COALESCE(
EXCLUDED.refresh_token_encrypted,
existing.refresh_token_encrypted
),
extra = CASE
WHEN EXCLUDED.extra = '{}'::jsonb THEN existing.extra
ELSE EXCLUDED.extra
END,
last_verified_at = NULL,
last_verify_ok = NULL,
last_verify_error = NULL