태그-실수 연관관계 hard delete VS soft delete #167
Closed
gorapaduckoo
started this conversation in
General
Replies: 2 comments 5 replies
-
|
Beta Was this translation helpful? Give feedback.
1 reply
-
테이블 설계를 변경한다면?
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
현재 상황
태그를 조회할 때 실수의 개수 mistakeCount도 List.size() 로 함께 조회해서 반환해줬는데, 그 결과 삭제된 실수의 개수까지 카운팅되는 문제가 발생했어요.
고민되는 부분
List.size()로 단순하게 조회하지 않고, 리스트에 담긴 객체의 삭제여부를 전부 검사하거나, 별도의 조회 쿼리를 날리는 방법이에요. 이렇게 하면 기존 코드를 많이 수정해야 한다는 단점이 있어요. 하지만 저희가 사용중인 soft delete에 어울리는 방법이고, 데이터를 보존하기 때문에 휴지통 등의 기능을 추가할 때 문제가 발생하지 않는다는 장점이 있어요.deleted_at컬럼을 추가하는 방법이에요. 하지만 이렇게 되면 태그를 할당 해제했다가 재할당하는 경우, 어떻게 처리할 것인지에 대해서도 결정해야 해요. 또 사이드 이펙트가 크다는 단점이 있어요.멘토님의 코멘트
Beta Was this translation helpful? Give feedback.
All reactions