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 | 62f9b35185bacfe5cc0bfcf34c485fc72bea9f10 (patch) | |
tree | e239a9a4f18c2d426a51ed2f7b570732857cd756 /util/src/entities/Webhook.ts | |
parent | :sparkles: finish and fix .delete() for one-to-many relations (diff) | |
download | server-62f9b35185bacfe5cc0bfcf34c485fc72bea9f10.tar.xz |
:bug: fix .delete -> add onDelete: "CASCADE"
Diffstat (limited to '')
-rw-r--r-- | util/src/entities/Webhook.ts | 20 |
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; } |