summary refs log tree commit diff
path: root/util/src/entities/Attachment.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/Attachment.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 'util/src/entities/Attachment.ts')
-rw-r--r--util/src/entities/Attachment.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/src/entities/Attachment.ts b/util/src/entities/Attachment.ts
index 82c5ecf5..7b4b17eb 100644
--- a/util/src/entities/Attachment.ts
+++ b/util/src/entities/Attachment.ts
@@ -31,7 +31,9 @@ export class Attachment extends BaseClass {
 	message_id: string;
 
 	@JoinColumn({ name: "message_id" })
-	@ManyToOne(() => require("./Message").Message, (message: import("./Message").Message) => message.attachments)
+	@ManyToOne(() => require("./Message").Message, (message: import("./Message").Message) => message.attachments, {
+		onDelete: "CASCADE",
+	})
 	message: import("./Message").Message;
 
 	@BeforeRemove()