Skip to content

Commit

Permalink
drop redundant constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaidashenko committed Dec 20, 2024
1 parent dba74ae commit cc8c764
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
2 changes: 0 additions & 2 deletions pkg/solana/logpoller/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ func (o *DSORM) InsertFilter(ctx context.Context, filter Filter) (id int64, err
INSERT INTO solana.log_poller_filters
(chain_id, name, address, event_name, event_sig, starting_block, event_idl, subkey_paths, retention, max_logs_kept)
VALUES (:chain_id, :name, :address, :event_name, :event_sig, :starting_block, :event_idl, :subkey_paths, :retention, :max_logs_kept)
ON CONFLICT (solana.f_log_poller_filter_hash(name, chain_id, address, event_sig, subkey_paths))
DO UPDATE SET retention=:retention ::::BIGINT, max_logs_kept=:max_logs_kept ::::NUMERIC, starting_block=:starting_block ::::NUMERIC
RETURNING id;`

query, sqlArgs, err := o.ds.BindNamed(query, args)
Expand Down
14 changes: 0 additions & 14 deletions pkg/solana/logpoller/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,9 @@ func TestLogPollerFilters(t *testing.T) {
dbFilter, err := orm.GetFilterByID(ctx, id)
require.NoError(t, err)
require.Equal(t, filter, dbFilter)

// subsequent insert of the same filter won't produce new db row
secondID, err := orm.InsertFilter(ctx, filter)
require.NoError(t, err)
require.Equal(t, secondID, id)
})
}
})
t.Run("Subsequent insert does not produce a new id", func(t *testing.T) {
filter := newRandomFilter(t)
ctx := tests.Context(t)
firstID, err := orm.InsertFilter(ctx, filter)
require.NoError(t, err)
secondID, err := orm.InsertFilter(ctx, filter)
require.NoError(t, err)
require.Equal(t, firstID, secondID)
})
t.Run("Returns and error if name is not unique", func(t *testing.T) {
filter := newRandomFilter(t)
ctx := tests.Context(t)
Expand Down

0 comments on commit cc8c764

Please sign in to comment.