-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storage: add chain.evm_tokens token_name index #466
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Add 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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,6 +309,10 @@ func (c *Client) listNexusMaterializedViews(ctx context.Context) ([]string, erro | |
|
||
// Wipe removes all contents of the database. | ||
func (c *Client) Wipe(ctx context.Context) error { | ||
if _, err := c.pool.Exec(ctx, "DROP EXTENSION IF EXISTS pg_trgm CASCADE;"); err != nil { | ||
return err | ||
} | ||
|
||
tables, err := c.listNexusTables(ctx) | ||
if err != nil { | ||
return err | ||
|
@@ -322,6 +326,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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really a TODO, now that we're dropping the extension? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can switch course to dropping all extensions (except for some) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see, so IIUC it's a TODO in the sense that if we added another extension, and that extension defined a custom type, and we chose not to use Maybe this line can be something a little milder? Like I don't see it as a realistic TODO, i.e. I don't expect us to ever need to work on it in a principled way. |
||
types, err := c.listNexusTypes(ctx) | ||
if err != nil { | ||
return err | ||
|
@@ -334,6 +339,7 @@ func (c *Client) Wipe(ctx context.Context) error { | |
} | ||
|
||
// List, then drop all custom functions. | ||
// TODO: Don't delete extensions' functions. | ||
functions, err := c.listNexusFunctions(ctx) | ||
if err != nil { | ||
return err | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this works out okay when it's at the beginning, because this way dropping the extension with cascade cleans up its types and functions