[fix] users 테이블 version 컬럼 추가#182
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
Changes데이터베이스 스키마 업데이트
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3분 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/resources/db/migration/V20260505__Add_version_column_to_users.sql`:
- Line 2: The migration adds a version column but omits a NOT NULL constraint;
update the migration so the users table's version column (column name: version)
is non-nullable to satisfy JPA `@Version` requirements by altering the ADD COLUMN
statement to include NOT NULL (or run an ALTER TABLE ... ALTER COLUMN ... SET
NOT NULL after populating defaults), ensuring existing rows are initialized to 0
and the column cannot contain NULL going forward.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3f98fbc3-38c8-49df-9f4a-5ba53054adae
📒 Files selected for processing (1)
src/main/resources/db/migration/V20260505__Add_version_column_to_users.sql
JPA @Version 필드는 낙관적 잠금을 위해 항상 non-null이어야 하므로 NOT NULL 제약 조건을 추가. DEFAULT 0이 설정되어 있어 기존 행은 안전하게 0으로 초기화됨. CodeRabbit 리뷰 반영.
🔖 관련 GitHub Issue
📝 변경 사항
주요 변경 내용
users테이블에version BIGINT DEFAULT 0컬럼을 추가하는 Flyway 마이그레이션 파일 생성V20260505__Add_version_column_to_users.sql상세 설명
User엔티티에 JPA Optimistic Locking을 위한@Version어노테이션이 추가되었으나, 대응되는 DB 마이그레이션 파일이 누락되어 있었습니다. 이로 인해 운영 서버의users테이블에version컬럼이 없어 다음과 같은 오류가 발생했습니다.영향 범위는
users테이블을 조회하는 모든 엔드포인트(로그인 포함)였으며, 사실상 모든 API 요청이 500 Internal Server Error를 반환하는 상태였습니다.해결 방법
BIGINT타입으로 컬럼 추가 (JavaLong타입과 매핑)DEFAULT 0으로 설정하여 기존 사용자 row의 version 값을 0으로 초기화 (JPA@Version표준 시작 값)✅ 체크리스트
🔗 관련 PR
Summary by CodeRabbit
릴리스 노트