Skip to content

Commit ff6f22e

Browse files
authored
feat: 사용자 차단 관련 엔티티 및 DDL 작성 (#507)
* feat: 사용자 차단 엔티티 작성 * feat: 사용자 차단 테이블 DDL 작성
1 parent 1cd50d4 commit ff6f22e

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.example.solidconnection.siteuser.domain;
2+
3+
import com.example.solidconnection.common.BaseEntity;
4+
import jakarta.persistence.Column;
5+
import jakarta.persistence.Entity;
6+
import jakarta.persistence.GeneratedValue;
7+
import jakarta.persistence.GenerationType;
8+
import jakarta.persistence.Id;
9+
import jakarta.persistence.Table;
10+
import jakarta.persistence.UniqueConstraint;
11+
import lombok.AccessLevel;
12+
import lombok.AllArgsConstructor;
13+
import lombok.Getter;
14+
import lombok.NoArgsConstructor;
15+
16+
@Getter
17+
@NoArgsConstructor(access = AccessLevel.PROTECTED)
18+
@Entity
19+
@AllArgsConstructor
20+
@Table(uniqueConstraints = {
21+
@UniqueConstraint(
22+
name = "uk_user_block_blocker_id_blocked_id",
23+
columnNames = {"blocker_id", "blocked_id"}
24+
)
25+
})
26+
public class UserBlock extends BaseEntity {
27+
28+
@Id
29+
@GeneratedValue(strategy = GenerationType.IDENTITY)
30+
private Long id;
31+
32+
@Column(name = "blocker_id", nullable = false)
33+
private long blockerId;
34+
35+
@Column(name = "blocked_id", nullable = false)
36+
private long blockedId;
37+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE TABLE user_block
2+
(
3+
id BIGINT NOT NULL AUTO_INCREMENT,
4+
blocker_id BIGINT NOT NULL,
5+
blocked_id BIGINT NOT NULL,
6+
created_at DATETIME(6) NOT NULL,
7+
updated_at DATETIME(6) NOT NULL,
8+
PRIMARY KEY (id),
9+
CONSTRAINT uk_user_block_blocker_id_blocked_id UNIQUE (blocker_id, blocked_id),
10+
CONSTRAINT fk_user_block_blocker_id FOREIGN KEY (blocker_id) REFERENCES site_user (id),
11+
CONSTRAINT fk_user_block_blocked_id FOREIGN KEY (blocked_id) REFERENCES site_user (id)
12+
);

0 commit comments

Comments
 (0)