File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed
java/com/example/solidconnection/siteuser/domain Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ );
You can’t perform that action at this time.
0 commit comments