Skip to content

Commit

Permalink
feat: member unique 제약조건 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
xxeol2 committed Sep 15, 2023
1 parent fe3e7da commit 7eef431
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion backend/src/main/java/com/festago/member/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,28 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.LocalDateTime;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

@Entity
@SQLDelete(sql = "UPDATE member SET deleted_at = now(), nickname = '탈퇴한 회원', profile_image = '' WHERE id=?")
@SQLDelete(sql = "UPDATE member SET deleted_at = now(), nickname = '탈퇴한 회원', profile_image = '', social_id = null, social_type = null WHERE id=?")
@Where(clause = "deleted_at is null")
@Table(
uniqueConstraints = {
@UniqueConstraint(
name = "UniqueSocialMember",
columnNames = {
"socialId",
"socialType"
}
)
}
)
public class Member extends BaseTimeEntity {

private static final String DEFAULT_IMAGE_URL = "https://festa-go.site/images/default-profile.png";
Expand Down

0 comments on commit 7eef431

Please sign in to comment.