From 7fc86d34e9ef8ebf29209d197c6d104e36a034cf Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Mon, 3 May 2021 20:42:43 +0300 Subject: [PATCH] Tweak counter reset logic --- backend/src/data/GuildCounters.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/src/data/GuildCounters.ts b/backend/src/data/GuildCounters.ts index 2d689295..4a64aaea 100644 --- a/backend/src/data/GuildCounters.ts +++ b/backend/src/data/GuildCounters.ts @@ -529,12 +529,9 @@ export class GuildCounters extends BaseGuildRepository { } async resetAllCounterValues(counterId: number): Promise { - await this.counterValues.delete({ - counter_id: counterId, - }); - - await this.counterTriggers.delete({ - counter_id: counterId, + // Foreign keys will remove any related triggers and counter values + await this.counters.delete({ + id: counterId, }); } }