diff --git a/troubleshooting/250909_happybell80_gmail_refresh_token_불일치.md b/troubleshooting/250909_happybell80_gmail_refresh_token_불일치.md index 5d8ebe1..01a245d 100644 --- a/troubleshooting/250909_happybell80_gmail_refresh_token_불일치.md +++ b/troubleshooting/250909_happybell80_gmail_refresh_token_불일치.md @@ -35,18 +35,18 @@ HanYong: token_data 비어있음 (8/30 이후) ## 해결 방안 ```sql --- 1. 긴급: DB 동기화 (무효 토큰 문제 즉시 해결) -UPDATE gmail_tokens -SET refresh_token = token_data->>'refresh_token', - access_token = token_data->>'access_token' -WHERE token_data IS NOT NULL; - --- 2. 근본: skill-email 코드 JSONB 전환 +-- skill-email 코드 JSONB 전용으로 수정 -- 63번: token_data->>'refresh_token' as refresh_token -- 166번: token_data = jsonb_set(...) 사용 + +-- 개별 컬럼 삭제 (코드 수정 후) +ALTER TABLE gmail_tokens +DROP COLUMN access_token, +DROP COLUMN refresh_token, +DROP COLUMN token_type, +DROP COLUMN expires_at; ``` ## 교훈 -- 레거시 컬럼과 JSONB 병행 사용 시 동기화 필수 -- 코드 마이그레이션 시 모든 서비스 일괄 수정 -- 토큰 갱신 실패 시 저장 위치 불일치 확인 \ No newline at end of file +- JSONB만 사용하여 데이터 일관성 확보 +- 중복 저장 구조는 반드시 제거 \ No newline at end of file