diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-20 20:22:56 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-20 20:22:56 +0200 |
commit | 576cbf5794b2e146892d7080b699882c2ba6ec6a (patch) | |
tree | ba0ee566a013053d90272126f2f5461ad6b1e30b /util/src/entities/Recipient.ts | |
parent | :sparkles: finish and fix .delete() for one-to-many relations (diff) | |
download | server-576cbf5794b2e146892d7080b699882c2ba6ec6a.tar.xz |
:bug: fix .delete -> add onDelete: "CASCADE"
Diffstat (limited to 'util/src/entities/Recipient.ts')
-rw-r--r-- | util/src/entities/Recipient.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/util/src/entities/Recipient.ts b/util/src/entities/Recipient.ts index bb280588..a945f938 100644 --- a/util/src/entities/Recipient.ts +++ b/util/src/entities/Recipient.ts @@ -8,7 +8,9 @@ export class Recipient extends BaseClass { channel_id: string; @JoinColumn({ name: "channel_id" }) - @ManyToOne(() => require("./Channel").Channel) + @ManyToOne(() => require("./Channel").Channel, { + onDelete: "CASCADE", + }) channel: import("./Channel").Channel; @Column() @@ -16,7 +18,9 @@ export class Recipient extends BaseClass { user_id: string; @JoinColumn({ name: "user_id" }) - @ManyToOne(() => require("./User").User) + @ManyToOne(() => require("./User").User, { + onDelete: "CASCADE", + }) user: import("./User").User; @Column({ default: false }) |