This commit is contained in:
parent
84e33024a7
commit
d58eb67764
2 changed files with 58 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue