diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-20 21:27:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-20 21:27:08 +0200 |
commit | 8af0094d8e8c46176cfbfac62e0b112f00c8e4be (patch) | |
tree | 0642670af9ad961d428d114ae9f24fa6a32626e6 /util/src/entities/Invite.ts | |
parent | Merge pull request #386 from ChrisChrome/master (diff) | |
parent | :bug: fix .delete -> add onDelete: "CASCADE" (diff) | |
download | server-8af0094d8e8c46176cfbfac62e0b112f00c8e4be.tar.xz |
Merge pull request #382 from fosscord/auto-delete-relations
Auto delete relations
Diffstat (limited to 'util/src/entities/Invite.ts')
-rw-r--r-- | util/src/entities/Invite.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/util/src/entities/Invite.ts b/util/src/entities/Invite.ts index 1396004e..78545b02 100644 --- a/util/src/entities/Invite.ts +++ b/util/src/entities/Invite.ts @@ -35,7 +35,9 @@ export class Invite extends BaseClass { guild_id: string; @JoinColumn({ name: "guild_id" }) - @ManyToOne(() => Guild) + @ManyToOne(() => Guild, { + onDelete: "CASCADE", + }) guild: Guild; @Column({ nullable: true }) @@ -43,7 +45,9 @@ export class Invite extends BaseClass { channel_id: string; @JoinColumn({ name: "channel_id" }) - @ManyToOne(() => Channel) + @ManyToOne(() => Channel, { + onDelete: "CASCADE", + }) channel: Channel; @Column({ nullable: true }) @@ -59,7 +63,9 @@ export class Invite extends BaseClass { target_user_id: string; @JoinColumn({ name: "target_user_id" }) - @ManyToOne(() => User) + @ManyToOne(() => User, { + onDelete: "CASCADE", + }) target_user?: string; // could be used for "User specific invites" https://github.com/fosscord/fosscord/issues/62 @Column({ nullable: true }) |