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] DB 테이블 auto increment 변경 여부 논의 #57

Open
Jake1152 opened this issue Aug 9, 2024 · 0 comments
Open

[REFACTOR] DB 테이블 auto increment 변경 여부 논의 #57

Jake1152 opened this issue Aug 9, 2024 · 0 comments
Assignees
Labels
question Further information is requested Refactor

Comments

@Jake1152
Copy link
Member

Jake1152 commented Aug 9, 2024

어떤 작업인가요?

  • auto increment를 쓰는 경우 DB에 종속되는 단점 발생
  • 다른 방식으로 pk id값 생성
    • uuid, binary char 등등

변경 전의 상황

  • DB 백업을 할 때에도 id 값은 auto increment였기에 추가할 수 없게됨
  • 여기서 id값을 다른 곳에서 fk로 쓴 경우 id 값을 join조건으로 쓰기에 백업에 제대로 안될 수 있음
  • e.g)
    • 백업 전
      • 기생충 movie id가 1, poll 테이블에 movie id 1과 user id 42로 투표가 되어있다고 할 때. 백업 뒤에는 테이블의 auto increment 제약 조건 때문에 movie 테이블에 movie id를 삽입할 수 없음, 이로 인하여 섞일 수도 있다는 단점 발생.
    • 백업 후
    • 기생충 movie id 52가 된다면 기존 poll 테이블 movie id와 매칭이 안되는 이슈 발생

변경 후의 예상하는 구조

DB에 종속되지 않는 pk id 유지, 자유로운 DB 백업 및 복원

참고할만한 자료(선택)

@Jake1152 Jake1152 self-assigned this Aug 9, 2024
@Jake1152 Jake1152 added the question Further information is requested label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Refactor
Projects
None yet
Development

No branches or pull requests

1 participant