Skip to content

Commit

Permalink
Fix: same API
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Oct 4, 2023
1 parent 323dce7 commit 655bd97
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/postgres/domains/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 655bd97

Please sign in to comment.