File tree Expand file tree Collapse file tree 6 files changed +21
-1
lines changed
main-server/src/main/java/com/example/demo/domain Expand file tree Collapse file tree 6 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 55import jakarta .persistence .*;
66import lombok .Getter ;
77import lombok .NoArgsConstructor ;
8+ import org .hibernate .annotations .OnDelete ;
9+ import org .hibernate .annotations .OnDeleteAction ;
810
911
1012@ Getter
@@ -21,10 +23,12 @@ public class Follow extends BaseTimeEntity {
2123 private Long id ;
2224
2325 @ ManyToOne (fetch = FetchType .LAZY )
26+ @ OnDelete (action = OnDeleteAction .CASCADE )
2427 @ JoinColumn (name = "follower_id" )
2528 private Users follower ; // ํ๋ก์ฐ ํ๋ ์ฌ๋
2629
2730 @ ManyToOne (fetch = FetchType .LAZY )
31+ @ OnDelete (action = OnDeleteAction .CASCADE )
2832 @ JoinColumn (name = "followee_id" )
2933 private Users followee ; // ํ๋ก์ฐ ๋นํ ๋์
3034
Original file line number Diff line number Diff line change 66import jakarta .persistence .*;
77import lombok .Getter ;
88import lombok .NoArgsConstructor ;
9+ import org .hibernate .annotations .OnDelete ;
10+ import org .hibernate .annotations .OnDeleteAction ;
911
1012@ Getter
1113@ Entity
@@ -21,10 +23,12 @@ public class Likes extends BaseTimeEntity {
2123 private Long id ;
2224
2325 @ ManyToOne (fetch = FetchType .LAZY )
26+ @ OnDelete (action = OnDeleteAction .CASCADE )
2427 @ JoinColumn (name = "user_id" )
2528 private Users users ;
2629
2730 @ ManyToOne (fetch = FetchType .LAZY )
31+ @ OnDelete (action = OnDeleteAction .CASCADE )
2832 @ JoinColumn (name = "playlist_id" )
2933 private Playlist playlist ;
3034
Original file line number Diff line number Diff line change 77import lombok .Builder ;
88import lombok .Getter ;
99import lombok .NoArgsConstructor ;
10+ import org .hibernate .annotations .OnDelete ;
11+ import org .hibernate .annotations .OnDeleteAction ;
1012
1113@ Getter
1214@ Entity
@@ -18,6 +20,7 @@ public class Playlist extends BaseTimeEntity {
1820 private Long id ;
1921
2022 @ ManyToOne (fetch = FetchType .LAZY )
23+ @ OnDelete (action = OnDeleteAction .CASCADE )
2124 @ JoinColumn (name = "user_id" )
2225 private Users users ;
2326
Original file line number Diff line number Diff line change 77import lombok .Builder ;
88import lombok .Getter ;
99import lombok .NoArgsConstructor ;
10+ import org .hibernate .annotations .OnDelete ;
11+ import org .hibernate .annotations .OnDeleteAction ;
1012
1113@ Entity
1214@ Getter
@@ -21,6 +23,7 @@ public class Prop extends BaseTimeEntity{
2123 private String theme ;
2224
2325 @ ManyToOne (fetch = FetchType .LAZY )
26+ @ OnDelete (action = OnDeleteAction .CASCADE )
2427 @ JoinColumn (name = "user_id" )
2528 private Users users ;
2629
Original file line number Diff line number Diff line change 99import jakarta .persistence .Id ;
1010import jakarta .persistence .ManyToOne ;
1111import java .time .LocalDateTime ;
12- import lombok .Builder ;
1312import lombok .Getter ;
1413import lombok .NoArgsConstructor ;
14+ import org .hibernate .annotations .OnDelete ;
15+ import org .hibernate .annotations .OnDeleteAction ;
1516
1617/**
1718 * ํ์์ด ์ธ์ ์ด๋ค ํ๋ ์ด๋ฆฌ์คํธ๋ฅผ ๋ค์๋๊ฐ
@@ -26,11 +27,13 @@ public class UserPlaylistHistory {
2627 private Long id ;
2728
2829 @ ManyToOne (fetch = FetchType .LAZY )
30+ @ OnDelete (action = OnDeleteAction .CASCADE )
2931 private Users user ;
3032
3133 private LocalDateTime playedAt ;
3234
3335 @ ManyToOne (fetch = FetchType .LAZY )
36+ @ OnDelete (action = OnDeleteAction .CASCADE )
3437 private Playlist playlist ;
3538
3639 private UserPlaylistHistory (Users user , Playlist playlist , LocalDateTime playedAt ) {
Original file line number Diff line number Diff line change 1212import lombok .Builder ;
1313import lombok .Getter ;
1414import lombok .NoArgsConstructor ;
15+ import org .hibernate .annotations .OnDelete ;
16+ import org .hibernate .annotations .OnDeleteAction ;
1517
1618@ Getter
1719@ Entity
@@ -23,6 +25,7 @@ public class Song {
2325 private Long id ;
2426
2527 @ ManyToOne (fetch = FetchType .LAZY )
28+ @ OnDelete (action = OnDeleteAction .CASCADE )
2629 @ JoinColumn (name ="playlist_id" , nullable =false )
2730 private Playlist playlist ;
2831
You canโt perform that action at this time.
0 commit comments