Skip to content

fix: 유저 하드 삭제 시 연쇄 삭제되도록 FK 제약 조건 수정#126

Merged
1Seob merged 1 commit intodevelopfrom
fix/user-hard-delete-cascade-constraints
Mar 12, 2026
Merged

fix: 유저 하드 삭제 시 연쇄 삭제되도록 FK 제약 조건 수정#126
1Seob merged 1 commit intodevelopfrom
fix/user-hard-delete-cascade-constraints

Conversation

@1Seob
Copy link
Collaborator

@1Seob 1Seob commented Mar 11, 2026

📝 요약(Summary)

users 하드 삭제 시 연관 데이터가 함께 삭제되도록 FK 제약 조건을 수정했습니다.

작업 이유

  • 현재 users는 soft delete 후 14일 뒤 hard delete
  • 이때 users 레코드만 삭제하더라도 연관 데이터가 FK cascade로 함께 정리되어야 함
  • 기존에는 일부 FK에 ON DELETE CASCADE가 없어 users 삭제가 막히거나, 연쇄 삭제가 중간에 끊길 수 있었음
  • 특히 users -> answer_entries -> daily_reports 삭제 체인이 완성되지 않아 정합성 문제가 발생할 수 있었음

작업 내용

  • answer_entries.user_id FK, daily_reports.answer_entry_id FK, weekly_reports.user_id FK, monthly_reports.user_id FK, user_daily_questions.user_id FK에 ON DELETE CASCADE를 적용

🔗 Related Issue

  • Closes:

💬 공유사항

✅ PR Checklist

PR이 다음 요구 사항을 충족하는지 확인하세요.

  • PR 제목을 커밋 메시지 컨벤션에 맞게 작성했습니다.

@coldsunn
Copy link
Collaborator

LGTM!

@1Seob 1Seob merged commit 90d051e into develop Mar 12, 2026
1 check passed
@1Seob 1Seob deleted the fix/user-hard-delete-cascade-constraints branch March 12, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants