Skip to content

Commit

Permalink
storage: add chain.evm_tokens token_name index
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Jun 27, 2023
1 parent ce16ddb commit 7105a94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions storage/migrations/08_evm_tokens_name_index.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Add a indexes for evm_tokens token names and symbols for search.

BEGIN;

CREATE EXTENSION pg_trgm;

CREATE INDEX ix_evm_tokens_name ON chain.evm_tokens USING GIST (token_name gist_trgm_ops);
CREATE INDEX ix_evm_tokens_symbol ON chain.evm_tokens USING GIST (symbol gist_trgm_ops);

COMMIT;
2 changes: 2 additions & 0 deletions storage/postgres/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ func (c *Client) Wipe(ctx context.Context) error {

// List, then drop all custom types.
// Query from https://stackoverflow.com/questions/3660787/how-to-list-custom-types-using-postgres-information-schema
// TODO: Don't delete extensions' types.
types, err := c.listIndexerTypes(ctx)
for _, typ := range types {
c.logger.Info("dropping type", "type", typ)
Expand All @@ -331,6 +332,7 @@ func (c *Client) Wipe(ctx context.Context) error {
}

// List, then drop all custom functions.
// TODO: Don't delete extensions' functions.
functions, err := c.listIndexerFunctions(ctx)
if err != nil {
return err
Expand Down

0 comments on commit 7105a94

Please sign in to comment.