-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
indexer-and-cache-migrations/1736866698_current_share_price.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
DROP TABLE base_indexer.json_rpc_cache; | ||
DROP TABLE base_proxy.json_rpc_cache; |
1 change: 1 addition & 0 deletions
1
indexer-and-cache-migrations/1737642182_create_raw_data_base_sepolia.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS base_sepolia_indexer.raw_data; |
35 changes: 35 additions & 0 deletions
35
indexer-and-cache-migrations/1737642182_create_raw_data_base_sepolia.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
CREATE SCHEMA IF NOT EXISTS base_sepolia_indexer; | ||
|
||
CREATE TABLE IF NOT EXISTS base_sepolia_indexer.raw_data ( | ||
id SERIAL PRIMARY KEY NOT NULL, | ||
gs_id VARCHAR(200), | ||
block_number BIGINT, | ||
block_hash VARCHAR(200), | ||
transaction_hash VARCHAR(200), | ||
transaction_index BIGINT, | ||
log_index BIGINT, | ||
address VARCHAR(42), | ||
data TEXT, | ||
topics TEXT[], | ||
block_timestamp BIGINT, | ||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | ||
); | ||
|
||
CREATE OR REPLACE FUNCTION base_sepolia_indexer.notify_raw_logs() | ||
RETURNS trigger AS $$ | ||
BEGIN | ||
PERFORM pg_notify('raw_logs_channel', row_to_json(NEW)::text); | ||
RETURN NEW; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
|
||
CREATE TRIGGER raw_logs_notify_trigger | ||
AFTER INSERT ON base_sepolia_indexer.raw_data | ||
FOR EACH ROW | ||
EXECUTE FUNCTION base_sepolia_indexer.notify_raw_logs(); | ||
|
||
CREATE INDEX idx_raw_data_block_number ON base_sepolia_indexer.raw_data(block_number); | ||
CREATE INDEX idx_raw_data_block_timestamp ON base_sepolia_indexer.raw_data(block_timestamp); | ||
CREATE INDEX idx_raw_data_transaction_hash ON base_sepolia_indexer.raw_data(transaction_hash); | ||
CREATE INDEX idx_raw_data_address ON base_sepolia_indexer.raw_data(address); | ||
CREATE INDEX idx_raw_data_topics ON base_sepolia_indexer.raw_data(topics); |