Skip to content
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

refactor: 많이 조회하는 키워드 테이블 제약 조건 추가 #903

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

seongjae6751
Copy link
Contributor

@seongjae6751 seongjae6751 commented Sep 19, 2024

🔥 연관 이슈

🚀 작업 내용

image

  1. 동시에 요청이 여러개가 들어올 때 중복 검사를 하지 못하고 두 개 이상이 저장 되는 것을 방지하기 위해 db에 unique 속성을 추가했습니다.
  2. 삭제 할 일이 사실상 없지만 cascade를 건 이유는 혹시나 모르게 삭제 할 일이 생길 경우 db의 참조 무결성을 보장하기 위해서 안전장치 용도로 걸었습니다.

💬 리뷰 중점사항

원래 동시성 제어 어노테이션이랑 같이 처리 할 생각이였는데 생각보다 동시성 제어 작업이 길어진 점과.. 따로 올리는 것이 낫겠다는 생각이 들어서 급히 올립니다.

@seongjae6751 seongjae6751 self-assigned this Sep 19, 2024
@github-actions github-actions bot added the 기능 새로운 기능을 개발합니다. label Sep 19, 2024
Copy link

github-actions bot commented Sep 19, 2024

Unit Test Results

294 tests   293 ✔️  1m 16s ⏱️
  33 suites      1 💤
  33 files        0

Results for commit 46a37fc.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@songsunkook songsunkook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

키워드 로직이 어떻게 구성되어있는지 몰라서 리뷰하기 어려울 것 같아요
오늘 안에 머지되어야 할테니 일단 어프로브 드리겠습니다.

import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Entity
@Table(name = "article_search_keyword_ip_map", indexes = {
@Index(name = "idx_ip_address", columnList = "ipAddress")
@Index(name = "idx_ip_address", columnList = "ipAddress")}, uniqueConstraints = {
@UniqueConstraint(name = "ux_keyword_ip", columnNames = {"keyword_id", "ipAddress"})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C

유니크를 걸어둬도 유니크 필드가 중복되면 결국 에러가 발생하는 것 아닌가요? 유니크만 걸어둬도 괜찮나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

동시성 제어 어노테이션으로 나중에 어플리케이션 단에서 막을 것입니다!

@seongjae6751 seongjae6751 merged commit 691cd22 into develop Sep 19, 2024
4 checks passed
@seongjae6751 seongjae6751 deleted the feature/add-constraints-to-keyword-tables branch September 19, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
기능 새로운 기능을 개발합니다.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants