Skip to content

Commit a9efc1c

Browse files
authored
notification_history.review_cycle_id unique constraint 추가 (#86)
* chore: NotificationHistory review_cycle_id에 유니크 제약 조건 추가 * refactor: NotificationHistory 유니크 제약 조건명 명시 * style: NotificationHistory 테이블 설정 개행 정리
1 parent e0fcf91 commit a9efc1c

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/main/java/com/recyclestudy/review/domain/NotificationHistory.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import jakarta.persistence.JoinColumn;
1111
import jakarta.persistence.ManyToOne;
1212
import jakarta.persistence.Table;
13+
import jakarta.persistence.UniqueConstraint;
1314
import java.time.LocalDateTime;
1415
import lombok.AccessLevel;
1516
import lombok.AllArgsConstructor;
@@ -18,7 +19,13 @@
1819
import lombok.experimental.FieldNameConstants;
1920

2021
@Entity
21-
@Table(name = "notification_history")
22+
@Table(
23+
name = "notification_history",
24+
uniqueConstraints = @UniqueConstraint(
25+
name = "uk_notification_history_review_cycle_id",
26+
columnNames = "review_cycle_id"
27+
)
28+
)
2229
@NoArgsConstructor(access = AccessLevel.PROTECTED)
2330
@AllArgsConstructor(access = AccessLevel.PRIVATE)
2431
@FieldNameConstants(level = AccessLevel.PRIVATE)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE notification_history
2+
ADD CONSTRAINT uk_notification_history_review_cycle_id UNIQUE (review_cycle_id);

0 commit comments

Comments
 (0)