From 655bd9746bac94d309804988bca165a5a0a90c53 Mon Sep 17 00:00:00 2001 From: Artem Date: Wed, 4 Oct 2023 18:46:33 +0200 Subject: [PATCH] Fix: same API --- internal/postgres/domains/storage.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/postgres/domains/storage.go b/internal/postgres/domains/storage.go index 36fbdf812..304d05398 100644 --- a/internal/postgres/domains/storage.go +++ b/internal/postgres/domains/storage.go @@ -54,9 +54,12 @@ func (storage *Storage) Same(ctx context.Context, network string, c contract.Con Join("LEFT JOIN ?.scripts as alpha on alpha.id = contracts.alpha_id", schema). Join("LEFT JOIN ?.scripts as babylon on babylon.id = contracts.babylon_id", schema). Join("LEFT JOIN ?.scripts as jakarta on jakarta.id = contracts.jakarta_id", schema). - Where("alpha.hash = ?", script.Hash). - WhereOr("babylon.hash = ?", script.Hash). - WhereOr("jakarta.hash = ?", script.Hash) + WhereGroup(" AND ", func(sq *bun.SelectQuery) *bun.SelectQuery { + return sq. + Where("alpha.hash = ?", script.Hash). + WhereOr("babylon.hash = ?", script.Hash). + WhereOr("jakarta.hash = ?", script.Hash) + }) if value == network { query.Where("contracts.id != ?", c.ID)