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 21:27:08 +0200
committerGitHub <noreply@github.com>2021-09-20 21:27:08 +0200
commit8af0094d8e8c46176cfbfac62e0b112f00c8e4be (patch)
tree0642670af9ad961d428d114ae9f24fa6a32626e6 /util/src/entities/Webhook.ts
parentMerge pull request #386 from ChrisChrome/master (diff)
parent:bug: fix .delete -> add onDelete: "CASCADE" (diff)
downloadserver-8af0094d8e8c46176cfbfac62e0b112f00c8e4be.tar.xz
Merge pull request #382 from fosscord/auto-delete-relations
Auto delete relations
Diffstat (limited to 'util/src/entities/Webhook.ts')
-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; }