Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void saveAll(List<ClubMember> clubMembers) {
@Override
@Transactional
public void deleteAll(List<ClubMember> clubMembers) {
clubMemberRepository.deleteAllInBatch(clubMembers);
clubMemberRepository.deleteAll(clubMembers);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -23,10 +24,14 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@SQLDelete(sql = "update form set deleted_at = CURRENT_TIMESTAMP where id=?")
@SQLRestriction("deleted_at IS NULL")
public class Form extends BaseEntity {

@Id
Expand Down Expand Up @@ -54,6 +59,9 @@ public class Form extends BaseEntity {
@ManyToOne(fetch = FetchType.LAZY)
private Club club;

@Column(columnDefinition = "TIMESTAMP")
private LocalDateTime deletedAt;

@OneToMany(mappedBy = "form", cascade = CascadeType.ALL, orphanRemoval = true)
private List<FormField> formFields = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import java.time.LocalDateTime;
import java.util.List;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@SQLDelete(sql = "update form_field set deleted_at = CURRENT_TIMESTAMP where id=?")
@SQLRestriction("deleted_at IS NULL")
public class FormField extends BaseEntity {

@Id
Expand Down Expand Up @@ -49,6 +54,9 @@ public class FormField extends BaseEntity {
@ManyToOne(fetch = FetchType.LAZY)
private Form form;

@Column(columnDefinition = "TIMESTAMP")
private LocalDateTime deletedAt;
Comment on lines +57 to +58
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

deleted_at 컬럼 매핑을 명시적으로 고정 권장

SQLDelete에서 "deleted_at"를 사용하므로 컬럼 매핑도 명시해 두는 편이 안전합니다(네이밍 전략 변경 시 깨짐 방지, 타 엔티티와의 일관성 개선).

적용 diff:

-    @Column(columnDefinition = "TIMESTAMP")
+    @Column(name = "deleted_at", columnDefinition = "TIMESTAMP")
     private LocalDateTime deletedAt;

다음 스크립트로 네이밍 전략 사용 여부를 확인해 주세요(스네이크 케이스 자동 변환 의존 여부 점검).


🏁 Script executed:

#!/bin/bash
# Hibernate/Spring 네이밍 전략 설정 탐색
rg -n -C2 -e 'hibernate.*naming' -e 'PhysicalNamingStrategy' -e 'ImplicitNamingStrategy' -e 'spring\.jpa\.hibernate\.naming' -- \
  application*.yml application*.properties src/main/resources || true

# deleted_at 명시 매핑 사용 현황
rg -n '@Column\s*\(\s*name\s*=\s*"deleted_at"' -S

Length of output: 2092


deletedAt 컬럼에 name 속성 명시

현재 application 설정에 NamingStrategy가 별도 지정되어 있지 않아 기본 전략(camelCase→snake_case)에 의존 중입니다. 다른 엔티티들도 @Column(name = "deleted_at", …)을 사용하므로, FormField에도 일관성 유지와 네이밍 전략 변경 대비를 위해 다음과 같이 수정하세요.

-    @Column(columnDefinition = "TIMESTAMP")
+    @Column(name = "deleted_at", columnDefinition = "TIMESTAMP")

[src/main/java/ddingdong/ddingdongBE/domain/form/entity/FormField.java:57-58]

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Column(columnDefinition = "TIMESTAMP")
private LocalDateTime deletedAt;
@Column(name = "deleted_at", columnDefinition = "TIMESTAMP")
private LocalDateTime deletedAt;
🤖 Prompt for AI Agents
In src/main/java/ddingdong/ddingdongBE/domain/form/entity/FormField.java around
lines 57-58, the @Column on deletedAt lacks an explicit name which relies on the
default naming strategy; update the annotation to specify the column name as
deleted_at (e.g., @Column(name = "deleted_at", columnDefinition = "TIMESTAMP"))
so it matches other entities and remains stable if NamingStrategy changes.


@Builder
private FormField(
Long id,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE form
ADD deleted_at timestamp NULL;

ALTER TABLE form_field
ADD deleted_at timestamp NULL;
Loading