-
Notifications
You must be signed in to change notification settings - Fork 1
fix: 오늘의 루틴 완료 요약에서 completedCount가 totalCount 초과하는 문제 #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0dd0d15
fix: 오늘의 루틴 완료 요약에서 completedCount가 totalCount 초과하는 문제
littby 1579e80
fix: judgeUserResponse 트랜잭션 누락 수정
littby ce3279e
fix: 루틴 완료 upsert 동시성 이슈 해결
littby 8c21148
fix: routine_execution 중복 데이터 정리 및 unique 제약 마이그레이션 추가
littby 00d8e3c
fix: 동시 요청 시 rollback-only 트랜잭션에서 복구 시도하던 문제 수정
littby File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/resources/db/migration/V4__add_unique_constraint_routine_execution.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| DELETE re1 FROM routine_execution re1 | ||
| INNER JOIN routine_execution re2 | ||
| ON re1.routine_id = re2.routine_id | ||
| AND re1.executed_date = re2.executed_date | ||
| AND re1.id < re2.id; | ||
|
|
||
| ALTER TABLE routine_execution | ||
| ADD CONSTRAINT uk_routine_execution_routine_date | ||
| UNIQUE (routine_id, executed_date); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유니크 제약 마이그레이션이 필요합니다.
운영은 Flyway와
ddl-auto=validate를 사용하므로@UniqueConstraint만으로는 실제 DB에 유니크 키가 생성되지 않습니다. 이 문제를 발생시킨 기존 중복 행도 남아 있어 요약 값이 계속 잘못되고,findByRoutine_IdAndExecutedDate()가 다건 결과 예외를 낼 수 있습니다. 기존(routine_id, executed_date)중복 데이터를 도메인 규칙에 따라 하나로 정리한 뒤uk_routine_execution_routine_date를 추가하는 다음 버전 Flyway migration을 포함해 주셔야 한다고 합니다!