summary refs log tree commit diff
path: root/util/src/entities/Webhook.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-20 20:22:56 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-20 20:22:56 +0200
commit576cbf5794b2e146892d7080b699882c2ba6ec6a (patch)
treeba0ee566a013053d90272126f2f5461ad6b1e30b /util/src/entities/Webhook.ts
parent:sparkles: finish and fix .delete() for one-to-many relations (diff)
downloadserver-576cbf5794b2e146892d7080b699882c2ba6ec6a.tar.xz
:bug: fix .delete -> add onDelete: "CASCADE"
Diffstat (limited to '')
-rw-r--r--util/src/entities/Webhook.ts20
1 files changed, 15 insertions, 5 deletions
diff --git a/util/src/entities/Webhook.ts b/util/src/entities/Webhook.ts
index 12ba0d08..8382435f 100644
--- a/util/src/entities/Webhook.ts
+++ b/util/src/entities/Webhook.ts
@@ -32,7 +32,9 @@ export class Webhook extends BaseClass {
 	guild_id: string;
 
 	@JoinColumn({ name: "guild_id" })
-	@ManyToOne(() => Guild)
+	@ManyToOne(() => Guild, {
+		onDelete: "CASCADE",
+	})
 	guild: Guild;
 
 	@Column({ nullable: true })
@@ -40,7 +42,9 @@ export class Webhook extends BaseClass {
 	channel_id: string;
 
 	@JoinColumn({ name: "channel_id" })
-	@ManyToOne(() => Channel)
+	@ManyToOne(() => Channel, {
+		onDelete: "CASCADE",
+	})
 	channel: Channel;
 
 	@Column({ nullable: true })
@@ -48,7 +52,9 @@ export class Webhook extends BaseClass {
 	application_id: string;
 
 	@JoinColumn({ name: "application_id" })
-	@ManyToOne(() => Application)
+	@ManyToOne(() => Application, {
+		onDelete: "CASCADE",
+	})
 	application: Application;
 
 	@Column({ nullable: true })
@@ -56,7 +62,9 @@ export class Webhook extends BaseClass {
 	user_id: string;
 
 	@JoinColumn({ name: "user_id" })
-	@ManyToOne(() => User)
+	@ManyToOne(() => User, {
+		onDelete: "CASCADE",
+	})
 	user: User;
 
 	@Column({ nullable: true })
@@ -64,6 +72,8 @@ export class Webhook extends BaseClass {
 	source_guild_id: string;
 
 	@JoinColumn({ name: "source_guild_id" })
-	@ManyToOne(() => Guild)
+	@ManyToOne(() => Guild, {
+		onDelete: "CASCADE",
+	})
 	source_guild: Guild;
 }