commit
05db3c697f
@ -5,7 +5,6 @@ CREATE TABLE IF NOT EXISTS eth.receipt_cids (
|
|||||||
tx_id VARCHAR(66) NOT NULL,
|
tx_id VARCHAR(66) NOT NULL,
|
||||||
cid TEXT NOT NULL,
|
cid TEXT NOT NULL,
|
||||||
contract VARCHAR(66),
|
contract VARCHAR(66),
|
||||||
contract_hash VARCHAR(66),
|
|
||||||
post_state VARCHAR(66),
|
post_state VARCHAR(66),
|
||||||
post_status SMALLINT,
|
post_status SMALLINT,
|
||||||
PRIMARY KEY (tx_id, header_id, block_number)
|
PRIMARY KEY (tx_id, header_id, block_number)
|
||||||
|
@ -4,7 +4,6 @@ CREATE TABLE IF NOT EXISTS eth.state_cids (
|
|||||||
header_id VARCHAR(66) NOT NULL,
|
header_id VARCHAR(66) NOT NULL,
|
||||||
state_leaf_key VARCHAR(66) NOT NULL,
|
state_leaf_key VARCHAR(66) NOT NULL,
|
||||||
cid TEXT NOT NULL,
|
cid TEXT NOT NULL,
|
||||||
partial_path BYTEA NOT NULL,
|
|
||||||
diff BOOLEAN NOT NULL DEFAULT FALSE,
|
diff BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
balance NUMERIC, -- NULL if "removed"
|
balance NUMERIC, -- NULL if "removed"
|
||||||
nonce BIGINT, -- NULL if "removed"
|
nonce BIGINT, -- NULL if "removed"
|
||||||
|
@ -5,7 +5,6 @@ CREATE TABLE IF NOT EXISTS eth.storage_cids (
|
|||||||
state_leaf_key VARCHAR(66) NOT NULL,
|
state_leaf_key VARCHAR(66) NOT NULL,
|
||||||
storage_leaf_key VARCHAR(66) NOT NULL,
|
storage_leaf_key VARCHAR(66) NOT NULL,
|
||||||
cid TEXT NOT NULL,
|
cid TEXT NOT NULL,
|
||||||
partial_path BYTEA NOT NULL,
|
|
||||||
diff BOOLEAN NOT NULL DEFAULT FALSE,
|
diff BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
val BYTEA, -- NULL if "removed"
|
val BYTEA, -- NULL if "removed"
|
||||||
removed BOOLEAN NOT NULL,
|
removed BOOLEAN NOT NULL,
|
||||||
|
@ -1,54 +1,51 @@
|
|||||||
-- +goose Up
|
-- +goose Up
|
||||||
-- header indexes
|
-- header indexes
|
||||||
CREATE INDEX header_block_number_index ON eth.header_cids USING brin (block_number);
|
CREATE INDEX header_block_number_index ON eth.header_cids USING btree (block_number);
|
||||||
CREATE UNIQUE INDEX header_cid_block_number_index ON eth.header_cids USING btree (cid, block_number);
|
CREATE UNIQUE INDEX header_cid_block_number_index ON eth.header_cids USING btree (cid, block_number);
|
||||||
CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
|
CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
|
||||||
CREATE INDEX timestamp_index ON eth.header_cids USING brin (timestamp);
|
CREATE INDEX timestamp_index ON eth.header_cids USING btree (timestamp);
|
||||||
|
|
||||||
-- uncle indexes
|
-- uncle indexes
|
||||||
CREATE INDEX uncle_block_number_index ON eth.uncle_cids USING brin (block_number);
|
CREATE INDEX uncle_block_number_index ON eth.uncle_cids USING btree (block_number);
|
||||||
CREATE UNIQUE INDEX uncle_cid_block_number_index ON eth.uncle_cids USING btree (cid, block_number);
|
CREATE UNIQUE INDEX uncle_cid_block_number_index ON eth.uncle_cids USING btree (cid, block_number);
|
||||||
CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
|
CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
|
||||||
|
|
||||||
-- transaction indexes
|
-- transaction indexes
|
||||||
CREATE INDEX tx_block_number_index ON eth.transaction_cids USING brin (block_number);
|
CREATE INDEX tx_block_number_index ON eth.transaction_cids USING btree (block_number);
|
||||||
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
||||||
CREATE INDEX tx_cid_block_number_index ON eth.transaction_cids USING btree (cid, block_number);
|
CREATE INDEX tx_cid_block_number_index ON eth.transaction_cids USING btree (cid, block_number);
|
||||||
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
|
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
|
||||||
CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
|
CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
|
||||||
|
|
||||||
-- receipt indexes
|
-- receipt indexes
|
||||||
CREATE INDEX rct_block_number_index ON eth.receipt_cids USING brin (block_number);
|
CREATE INDEX rct_block_number_index ON eth.receipt_cids USING btree (block_number);
|
||||||
CREATE INDEX rct_header_id_index ON eth.receipt_cids USING btree (header_id);
|
CREATE INDEX rct_header_id_index ON eth.receipt_cids USING btree (header_id);
|
||||||
CREATE INDEX rct_cid_block_number_index ON eth.receipt_cids USING btree (cid, block_number);
|
CREATE INDEX rct_cid_block_number_index ON eth.receipt_cids USING btree (cid, block_number);
|
||||||
CREATE INDEX rct_contract_index ON eth.receipt_cids USING btree (contract);
|
CREATE INDEX rct_contract_index ON eth.receipt_cids USING btree (contract);
|
||||||
CREATE INDEX rct_contract_hash_index ON eth.receipt_cids USING btree (contract_hash);
|
|
||||||
|
|
||||||
-- state node indexes
|
-- state node indexes
|
||||||
CREATE INDEX state_block_number_index ON eth.state_cids USING brin (block_number);
|
CREATE INDEX state_block_number_index ON eth.state_cids USING btree (block_number);
|
||||||
CREATE INDEX state_cid_block_number_index ON eth.state_cids USING btree (cid, block_number);
|
CREATE INDEX state_cid_block_number_index ON eth.state_cids USING btree (cid, block_number);
|
||||||
CREATE INDEX state_header_id_index ON eth.state_cids USING btree (header_id);
|
CREATE INDEX state_header_id_index ON eth.state_cids USING btree (header_id);
|
||||||
CREATE INDEX state_partial_path_index ON eth.state_cids USING btree (partial_path);
|
|
||||||
CREATE INDEX state_removed_index ON eth.state_cids USING btree (removed);
|
CREATE INDEX state_removed_index ON eth.state_cids USING btree (removed);
|
||||||
CREATE INDEX state_code_hash_index ON eth.state_cids USING btree (code_hash); -- could be useful for e.g. selecting all the state accounts with the same contract bytecode deployed
|
CREATE INDEX state_code_hash_index ON eth.state_cids USING btree (code_hash); -- could be useful for e.g. selecting all the state accounts with the same contract bytecode deployed
|
||||||
CREATE INDEX state_leaf_key_block_number_index ON eth.state_cids(state_leaf_key, block_number DESC);
|
CREATE INDEX state_leaf_key_block_number_index ON eth.state_cids(state_leaf_key, block_number DESC);
|
||||||
|
|
||||||
-- storage node indexes
|
-- storage node indexes
|
||||||
CREATE INDEX storage_block_number_index ON eth.storage_cids USING brin (block_number);
|
CREATE INDEX storage_block_number_index ON eth.storage_cids USING btree (block_number);
|
||||||
CREATE INDEX storage_state_leaf_key_index ON eth.storage_cids USING btree (state_leaf_key);
|
CREATE INDEX storage_state_leaf_key_index ON eth.storage_cids USING btree (state_leaf_key);
|
||||||
CREATE INDEX storage_cid_block_number_index ON eth.storage_cids USING btree (cid, block_number);
|
CREATE INDEX storage_cid_block_number_index ON eth.storage_cids USING btree (cid, block_number);
|
||||||
CREATE INDEX storage_header_id_index ON eth.storage_cids USING btree (header_id);
|
CREATE INDEX storage_header_id_index ON eth.storage_cids USING btree (header_id);
|
||||||
CREATE INDEX storage_partial_path_index ON eth.storage_cids USING btree (partial_path);
|
|
||||||
CREATE INDEX storage_removed_index ON eth.storage_cids USING btree (removed);
|
CREATE INDEX storage_removed_index ON eth.storage_cids USING btree (removed);
|
||||||
CREATE INDEX storage_leaf_key_block_number_index ON eth.storage_cids(storage_leaf_key, block_number DESC);
|
CREATE INDEX storage_leaf_key_block_number_index ON eth.storage_cids(storage_leaf_key, block_number DESC);
|
||||||
|
|
||||||
-- access list indexes
|
-- access list indexes
|
||||||
CREATE INDEX access_list_block_number_index ON eth.access_list_elements USING brin (block_number);
|
CREATE INDEX access_list_block_number_index ON eth.access_list_elements USING btree (block_number);
|
||||||
CREATE INDEX access_list_element_address_index ON eth.access_list_elements USING btree (address);
|
CREATE INDEX access_list_element_address_index ON eth.access_list_elements USING btree (address);
|
||||||
CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gin (storage_keys);
|
CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gin (storage_keys);
|
||||||
|
|
||||||
-- log indexes
|
-- log indexes
|
||||||
CREATE INDEX log_block_number_index ON eth.log_cids USING brin (block_number);
|
CREATE INDEX log_block_number_index ON eth.log_cids USING btree (block_number);
|
||||||
CREATE INDEX log_header_id_index ON eth.log_cids USING btree (header_id);
|
CREATE INDEX log_header_id_index ON eth.log_cids USING btree (header_id);
|
||||||
CREATE INDEX log_cid_block_number_index ON eth.log_cids USING btree (cid, block_number);
|
CREATE INDEX log_cid_block_number_index ON eth.log_cids USING btree (cid, block_number);
|
||||||
CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
|
CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
|
||||||
@ -75,7 +72,6 @@ DROP INDEX eth.access_list_block_number_index;
|
|||||||
|
|
||||||
-- storage node indexes
|
-- storage node indexes
|
||||||
DROP INDEX eth.storage_removed_index;
|
DROP INDEX eth.storage_removed_index;
|
||||||
DROP INDEX eth.storage_partial_path_index;
|
|
||||||
DROP INDEX eth.storage_header_id_index;
|
DROP INDEX eth.storage_header_id_index;
|
||||||
DROP INDEX eth.storage_cid_block_number_index;
|
DROP INDEX eth.storage_cid_block_number_index;
|
||||||
DROP INDEX eth.storage_leaf_key_index;
|
DROP INDEX eth.storage_leaf_key_index;
|
||||||
@ -86,14 +82,12 @@ DROP INDEX eth.storage_leaf_key_block_number_index;
|
|||||||
-- state node indexes
|
-- state node indexes
|
||||||
DROP INDEX eth.state_code_hash_index;
|
DROP INDEX eth.state_code_hash_index;
|
||||||
DROP INDEX eth.state_removed_index;
|
DROP INDEX eth.state_removed_index;
|
||||||
DROP INDEX eth.state_partial_path_index;
|
|
||||||
DROP INDEX eth.state_header_id_index;
|
DROP INDEX eth.state_header_id_index;
|
||||||
DROP INDEX eth.state_cid_block_number_index;
|
DROP INDEX eth.state_cid_block_number_index;
|
||||||
DROP INDEX eth.state_block_number_index;
|
DROP INDEX eth.state_block_number_index;
|
||||||
DROP INDEX eth.state_leaf_key_block_number_index;
|
DROP INDEX eth.state_leaf_key_block_number_index;
|
||||||
|
|
||||||
-- receipt indexes
|
-- receipt indexes
|
||||||
DROP INDEX eth.rct_contract_hash_index;
|
|
||||||
DROP INDEX eth.rct_contract_index;
|
DROP INDEX eth.rct_contract_index;
|
||||||
DROP INDEX eth.rct_cid_block_number_index;
|
DROP INDEX eth.rct_cid_block_number_index;
|
||||||
DROP INDEX eth.rct_header_id_index;
|
DROP INDEX eth.rct_header_id_index;
|
@ -1,21 +0,0 @@
|
|||||||
-- +goose Up
|
|
||||||
-- pending tx isn't tightly associated with a block height, so we can't insert the RLP encoded tx as an IPLD block
|
|
||||||
-- in ipld.blocks since it is denormalized by block number (we could do something hacky like using head height
|
|
||||||
-- when the block was seen, or 0 or -1 or something)
|
|
||||||
-- instead, what we are doing for the time being is embedding the RLP here
|
|
||||||
CREATE TABLE IF NOT EXISTS eth.pending_txs (
|
|
||||||
tx_hash VARCHAR(66) NOT NULL PRIMARY KEY,
|
|
||||||
block_hash VARCHAR(66) NOT NULL, -- references block_hash in pending_blocks for the pending block this tx belongs to
|
|
||||||
timestamp BIGINT NOT NULL,
|
|
||||||
raw BYTEA NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS eth.pending_blocks (
|
|
||||||
block_hash VARCHAR(66) NOT NULL PRIMARY KEY,
|
|
||||||
block_number BIGINT NOT NULL,
|
|
||||||
raw_header BYTEA NOT NULL
|
|
||||||
)
|
|
||||||
|
|
||||||
-- +goose Down
|
|
||||||
DROP TABLE eth.pending_blocks;
|
|
||||||
DROP TABLE eth.pending_txs;
|
|
@ -5,5 +5,8 @@ CREATE TABLE IF NOT EXISTS public.db_version (
|
|||||||
tstamp TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW()
|
tstamp TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
INSERT INTO public.db_version (singleton, version) VALUES (true, 'v5.0.0')
|
||||||
|
ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v5.0.0', NOW());
|
||||||
|
|
||||||
-- +goose Down
|
-- +goose Down
|
||||||
DROP TABLE public.db_version;
|
DROP TABLE public.db_version;
|
@ -1,113 +0,0 @@
|
|||||||
-- +goose Up
|
|
||||||
-- Name: graphql_subscription(); Type: FUNCTION; Schema: eth; Owner: -
|
|
||||||
|
|
||||||
-- +goose StatementBegin
|
|
||||||
CREATE FUNCTION eth.graphql_subscription() RETURNS TRIGGER AS $$
|
|
||||||
DECLARE
|
|
||||||
obj jsonb;
|
|
||||||
BEGIN
|
|
||||||
IF (TG_TABLE_NAME = 'state_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.state_path
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'storage_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.state_path,
|
|
||||||
NEW.storage_path
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'log_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.rct_id,
|
|
||||||
NEW.index
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'receipt_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.tx_id
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'transaction_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.tx_hash
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'access_list_elements') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.tx_id,
|
|
||||||
NEW.index
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'uncle_cids') OR (TG_TABLE_NAME = 'header_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.block_hash
|
|
||||||
);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
perform pg_notify('postgraphile:' || TG_RELNAME , json_build_object(
|
|
||||||
'__node__', obj
|
|
||||||
)::text
|
|
||||||
);
|
|
||||||
RETURN NEW;
|
|
||||||
END;
|
|
||||||
$$ language plpgsql;
|
|
||||||
-- +goose StatementEnd
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_header_cids
|
|
||||||
AFTER INSERT ON eth.header_cids
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE eth.graphql_subscription();
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_uncle_cids
|
|
||||||
AFTER INSERT ON eth.uncle_cids
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE eth.graphql_subscription();
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_transaction_cids
|
|
||||||
AFTER INSERT ON eth.transaction_cids
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE eth.graphql_subscription();
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_receipt_cids
|
|
||||||
AFTER INSERT ON eth.receipt_cids
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE eth.graphql_subscription();
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_state_cids
|
|
||||||
AFTER INSERT ON eth.state_cids
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE eth.graphql_subscription();
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_log_cids
|
|
||||||
AFTER INSERT ON eth.log_cids
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE eth.graphql_subscription();
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_storage_cids
|
|
||||||
AFTER INSERT ON eth.storage_cids
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE eth.graphql_subscription();
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_access_list_elements
|
|
||||||
AFTER INSERT ON eth.access_list_elements
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE eth.graphql_subscription();
|
|
||||||
|
|
||||||
-- +goose Down
|
|
||||||
DROP TRIGGER trg_eth_uncle_cids ON eth.uncle_cids;
|
|
||||||
DROP TRIGGER trg_eth_transaction_cids ON eth.transaction_cids;
|
|
||||||
DROP TRIGGER trg_eth_storage_cids ON eth.storage_cids;
|
|
||||||
DROP TRIGGER trg_eth_state_cids ON eth.state_cids;
|
|
||||||
DROP TRIGGER trg_eth_receipt_cids ON eth.receipt_cids;
|
|
||||||
DROP TRIGGER trg_eth_header_cids ON eth.header_cids;
|
|
||||||
DROP TRIGGER trg_eth_log_cids ON eth.log_cids;
|
|
||||||
DROP TRIGGER trg_eth_access_list_elements ON eth.access_list_elements;
|
|
||||||
|
|
||||||
DROP FUNCTION eth.graphql_subscription();
|
|
@ -10,12 +10,12 @@ SELECT create_hypertable('eth.access_list_elements', 'block_number', migrate_dat
|
|||||||
SELECT create_hypertable('eth.log_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768);
|
SELECT create_hypertable('eth.log_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768);
|
||||||
|
|
||||||
-- update version
|
-- update version
|
||||||
INSERT INTO public.db_version (singleton, version) VALUES (true, 'v4.0.0-h')
|
INSERT INTO public.db_version (singleton, version) VALUES (true, 'v5.0.0-h')
|
||||||
ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v4.0.0-h', NOW());
|
ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v5.0.0-h', NOW());
|
||||||
|
|
||||||
-- +goose Down
|
-- +goose Down
|
||||||
INSERT INTO public.db_version (singleton, version) VALUES (true, 'v4.0.0')
|
INSERT INTO public.db_version (singleton, version) VALUES (true, 'v5.0.0')
|
||||||
ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v4.0.0', NOW());
|
ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v5.0.0', NOW());
|
||||||
|
|
||||||
-- reversing conversion to hypertable requires migrating all data from every chunk back to a single table
|
-- reversing conversion to hypertable requires migrating all data from every chunk back to a single table
|
||||||
-- create new regular tables
|
-- create new regular tables
|
@ -1,97 +0,0 @@
|
|||||||
-- +goose Up
|
|
||||||
-- peer tx represents a tx that has been seen by a peer
|
|
||||||
-- the same tx (hash) can be seen by different peers
|
|
||||||
-- or received by different probes
|
|
||||||
-- so the primary key is a composite on (raw_peer_id, tx_hash, received_by_probe)
|
|
||||||
-- this table is persistent, and continues to map probe/peer meta_data to transaction hashes
|
|
||||||
-- whether they are in the canonical tx table or the pending tx table
|
|
||||||
CREATE TABLE eth_meta.peer_tx (
|
|
||||||
raw_peer_id bytea NOT NULL,
|
|
||||||
tx_hash VARCHAR(66) NOT NULL,
|
|
||||||
received timestamp with time zone NOT NULL,
|
|
||||||
received_by_probe integer NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.asn (
|
|
||||||
id BIGINT NOT NULL,
|
|
||||||
asn INTEGER NOT NULL,
|
|
||||||
registry TEXT NOT NULL,
|
|
||||||
country_code TEXT NOT NULL,
|
|
||||||
name TEXT NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.peer (
|
|
||||||
asn_id BIGINT NOT NULL,
|
|
||||||
prefix CIDR NOT NULL,
|
|
||||||
rdns TEXT,
|
|
||||||
raw_dht_peer_id BIGINT,
|
|
||||||
city TEXT,
|
|
||||||
country TEXT,
|
|
||||||
coords JSONB
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.peer_dht (
|
|
||||||
dht_peer_id BIGINT NOT NULL,
|
|
||||||
neighbor_id BIGINT NOT NULL,
|
|
||||||
seen TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
||||||
seen_by_probe INTEGER NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.peer_seen (
|
|
||||||
raw_peer_id BYTEA NOT NULL,
|
|
||||||
first_seen TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
||||||
probe_id INTEGER NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.probe (
|
|
||||||
id INTEGER NOT NULL,
|
|
||||||
ip INET NOT NULL,
|
|
||||||
deployed TIMESTAMP WITH TIME ZONE NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.raw_dht_peer (
|
|
||||||
id BIGINT NOT NULL,
|
|
||||||
pubkey BYTEA NOT NULL,
|
|
||||||
ip INET NOT NULL,
|
|
||||||
port INTEGER NOT NULL,
|
|
||||||
client_id TEXT,
|
|
||||||
network_id BYTEA,
|
|
||||||
genesis_hash BYTEA,
|
|
||||||
forks JSONB,
|
|
||||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
|
||||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.raw_peer (
|
|
||||||
id BYTEA NOT NULL,
|
|
||||||
ip INET NOT NULL,
|
|
||||||
port INTEGER NOT NULL,
|
|
||||||
client_id TEXT NOT NULL,
|
|
||||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.site (
|
|
||||||
id INTEGER NOT NULL,
|
|
||||||
provider TEXT NOT NULL,
|
|
||||||
az TEXT NOT NULL,
|
|
||||||
probe_id INTEGER NOT NULL,
|
|
||||||
privkey BYTEA NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.tx_chain (
|
|
||||||
id BYTEA NOT NULL,
|
|
||||||
height INTEGER NOT NULL,
|
|
||||||
ts TIMESTAMP WITH TIME ZONE NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
-- +goose Down
|
|
||||||
DROP TABLE eth_meta.tx_chain;
|
|
||||||
DROP TABLE eth_meta.site;
|
|
||||||
DROP TABLE eth_meta.raw_peer;
|
|
||||||
DROP TABLE eth_meta.raw_dht_peer;
|
|
||||||
DROP TABLE eth_meta.probe;
|
|
||||||
DROP TABLE eth_meta.peer_seen;
|
|
||||||
DROP TABLE eth_meta.peer_dht;
|
|
||||||
DROP TABLE eth_meta.peer;
|
|
||||||
DROP TABLE eth_meta.asn;
|
|
||||||
DROP TABLE eth_meta.peer_tx;
|
|
@ -1,6 +0,0 @@
|
|||||||
-- +goose Up
|
|
||||||
INSERT INTO public.db_version (singleton, version) VALUES (true, 'v5.0.0')
|
|
||||||
ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v5.0.0', NOW());
|
|
||||||
|
|
||||||
-- +goose Down
|
|
||||||
DELETE FROM public.db_version WHERE version = 'v5.0.0';
|
|
310
schema.sql
310
schema.sql
@ -101,69 +101,6 @@ CREATE TYPE public.child_result AS (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: graphql_subscription(); Type: FUNCTION; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE FUNCTION eth.graphql_subscription() RETURNS trigger
|
|
||||||
LANGUAGE plpgsql
|
|
||||||
AS $$
|
|
||||||
DECLARE
|
|
||||||
obj jsonb;
|
|
||||||
BEGIN
|
|
||||||
IF (TG_TABLE_NAME = 'state_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.state_path
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'storage_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.state_path,
|
|
||||||
NEW.storage_path
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'log_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.rct_id,
|
|
||||||
NEW.index
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'receipt_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.tx_id
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'transaction_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.header_id,
|
|
||||||
NEW.tx_hash
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'access_list_elements') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.tx_id,
|
|
||||||
NEW.index
|
|
||||||
);
|
|
||||||
ELSIF (TG_TABLE_NAME = 'uncle_cids') OR (TG_TABLE_NAME = 'header_cids') THEN
|
|
||||||
obj := json_build_array(
|
|
||||||
TG_TABLE_NAME,
|
|
||||||
NEW.block_hash
|
|
||||||
);
|
|
||||||
END IF;
|
|
||||||
perform pg_notify('postgraphile:' || TG_RELNAME , json_build_object(
|
|
||||||
'__node__', obj
|
|
||||||
)::text
|
|
||||||
);
|
|
||||||
RETURN NEW;
|
|
||||||
END;
|
|
||||||
$$;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: canonical_header_from_array(eth.header_cids[]); Type: FUNCTION; Schema: public; Owner: -
|
-- Name: canonical_header_from_array(eth.header_cids[]); Type: FUNCTION; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@ -332,18 +269,6 @@ CREATE TABLE eth.log_cids (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: pending_txs; Type: TABLE; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth.pending_txs (
|
|
||||||
tx_hash character varying(66) NOT NULL,
|
|
||||||
block_hash character varying(66) NOT NULL,
|
|
||||||
"timestamp" bigint NOT NULL,
|
|
||||||
raw bytea NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: receipt_cids; Type: TABLE; Schema: eth; Owner: -
|
-- Name: receipt_cids; Type: TABLE; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
@ -354,7 +279,6 @@ CREATE TABLE eth.receipt_cids (
|
|||||||
tx_id character varying(66) NOT NULL,
|
tx_id character varying(66) NOT NULL,
|
||||||
cid text NOT NULL,
|
cid text NOT NULL,
|
||||||
contract character varying(66),
|
contract character varying(66),
|
||||||
contract_hash character varying(66),
|
|
||||||
post_state character varying(66),
|
post_state character varying(66),
|
||||||
post_status smallint
|
post_status smallint
|
||||||
);
|
);
|
||||||
@ -369,7 +293,6 @@ CREATE TABLE eth.state_cids (
|
|||||||
header_id character varying(66) NOT NULL,
|
header_id character varying(66) NOT NULL,
|
||||||
state_leaf_key character varying(66) NOT NULL,
|
state_leaf_key character varying(66) NOT NULL,
|
||||||
cid text NOT NULL,
|
cid text NOT NULL,
|
||||||
partial_path bytea NOT NULL,
|
|
||||||
diff boolean DEFAULT false NOT NULL,
|
diff boolean DEFAULT false NOT NULL,
|
||||||
balance numeric,
|
balance numeric,
|
||||||
nonce bigint,
|
nonce bigint,
|
||||||
@ -389,7 +312,6 @@ CREATE TABLE eth.storage_cids (
|
|||||||
state_leaf_key character varying(66) NOT NULL,
|
state_leaf_key character varying(66) NOT NULL,
|
||||||
storage_leaf_key character varying(66) NOT NULL,
|
storage_leaf_key character varying(66) NOT NULL,
|
||||||
cid text NOT NULL,
|
cid text NOT NULL,
|
||||||
partial_path bytea NOT NULL,
|
|
||||||
diff boolean DEFAULT false NOT NULL,
|
diff boolean DEFAULT false NOT NULL,
|
||||||
val bytea,
|
val bytea,
|
||||||
removed boolean NOT NULL
|
removed boolean NOT NULL
|
||||||
@ -435,135 +357,6 @@ CREATE TABLE eth.uncle_cids (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: asn; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.asn (
|
|
||||||
id bigint NOT NULL,
|
|
||||||
asn integer NOT NULL,
|
|
||||||
registry text NOT NULL,
|
|
||||||
country_code text NOT NULL,
|
|
||||||
name text NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: peer; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.peer (
|
|
||||||
asn_id bigint NOT NULL,
|
|
||||||
prefix cidr NOT NULL,
|
|
||||||
rdns text,
|
|
||||||
raw_dht_peer_id bigint,
|
|
||||||
city text,
|
|
||||||
country text,
|
|
||||||
coords jsonb
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: peer_dht; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.peer_dht (
|
|
||||||
dht_peer_id bigint NOT NULL,
|
|
||||||
neighbor_id bigint NOT NULL,
|
|
||||||
seen timestamp with time zone NOT NULL,
|
|
||||||
seen_by_probe integer NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: peer_seen; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.peer_seen (
|
|
||||||
raw_peer_id bytea NOT NULL,
|
|
||||||
first_seen timestamp with time zone NOT NULL,
|
|
||||||
probe_id integer NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: peer_tx; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.peer_tx (
|
|
||||||
raw_peer_id bytea NOT NULL,
|
|
||||||
tx_hash character varying(66) NOT NULL,
|
|
||||||
received timestamp with time zone NOT NULL,
|
|
||||||
received_by_probe integer NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: probe; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.probe (
|
|
||||||
id integer NOT NULL,
|
|
||||||
ip inet NOT NULL,
|
|
||||||
deployed timestamp with time zone NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: raw_dht_peer; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.raw_dht_peer (
|
|
||||||
id bigint NOT NULL,
|
|
||||||
pubkey bytea NOT NULL,
|
|
||||||
ip inet NOT NULL,
|
|
||||||
port integer NOT NULL,
|
|
||||||
client_id text,
|
|
||||||
network_id bytea,
|
|
||||||
genesis_hash bytea,
|
|
||||||
forks jsonb,
|
|
||||||
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
||||||
updated_at timestamp with time zone DEFAULT now() NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: raw_peer; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.raw_peer (
|
|
||||||
id bytea NOT NULL,
|
|
||||||
ip inet NOT NULL,
|
|
||||||
port integer NOT NULL,
|
|
||||||
client_id text NOT NULL,
|
|
||||||
created_at timestamp with time zone DEFAULT now() NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: site; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.site (
|
|
||||||
id integer NOT NULL,
|
|
||||||
provider text NOT NULL,
|
|
||||||
az text NOT NULL,
|
|
||||||
probe_id integer NOT NULL,
|
|
||||||
privkey bytea NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: tx_chain; Type: TABLE; Schema: eth_meta; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE eth_meta.tx_chain (
|
|
||||||
id bytea NOT NULL,
|
|
||||||
height integer NOT NULL,
|
|
||||||
ts timestamp with time zone NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: watched_addresses; Type: TABLE; Schema: eth_meta; Owner: -
|
-- Name: watched_addresses; Type: TABLE; Schema: eth_meta; Owner: -
|
||||||
--
|
--
|
||||||
@ -689,14 +482,6 @@ ALTER TABLE ONLY eth.log_cids
|
|||||||
ADD CONSTRAINT log_cids_pkey PRIMARY KEY (rct_id, index, header_id, block_number);
|
ADD CONSTRAINT log_cids_pkey PRIMARY KEY (rct_id, index, header_id, block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: pending_txs pending_txs_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE ONLY eth.pending_txs
|
|
||||||
ADD CONSTRAINT pending_txs_pkey PRIMARY KEY (tx_hash);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: receipt_cids receipt_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
-- Name: receipt_cids receipt_cids_pkey; Type: CONSTRAINT; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
@ -781,7 +566,7 @@ ALTER TABLE ONLY public.nodes
|
|||||||
-- Name: access_list_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: access_list_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX access_list_block_number_index ON eth.access_list_elements USING brin (block_number);
|
CREATE INDEX access_list_block_number_index ON eth.access_list_elements USING btree (block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -802,7 +587,7 @@ CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gi
|
|||||||
-- Name: header_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: header_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX header_block_number_index ON eth.header_cids USING brin (block_number);
|
CREATE INDEX header_block_number_index ON eth.header_cids USING btree (block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -823,7 +608,7 @@ CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
|
|||||||
-- Name: log_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: log_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX log_block_number_index ON eth.log_cids USING brin (block_number);
|
CREATE INDEX log_block_number_index ON eth.log_cids USING btree (block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -872,7 +657,7 @@ CREATE INDEX log_topic3_index ON eth.log_cids USING btree (topic3);
|
|||||||
-- Name: rct_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: rct_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX rct_block_number_index ON eth.receipt_cids USING brin (block_number);
|
CREATE INDEX rct_block_number_index ON eth.receipt_cids USING btree (block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -882,13 +667,6 @@ CREATE INDEX rct_block_number_index ON eth.receipt_cids USING brin (block_number
|
|||||||
CREATE INDEX rct_cid_block_number_index ON eth.receipt_cids USING btree (cid, block_number);
|
CREATE INDEX rct_cid_block_number_index ON eth.receipt_cids USING btree (cid, block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: rct_contract_hash_index; Type: INDEX; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX rct_contract_hash_index ON eth.receipt_cids USING btree (contract_hash);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: rct_contract_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: rct_contract_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
@ -907,7 +685,7 @@ CREATE INDEX rct_header_id_index ON eth.receipt_cids USING btree (header_id);
|
|||||||
-- Name: state_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: state_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX state_block_number_index ON eth.state_cids USING brin (block_number);
|
CREATE INDEX state_block_number_index ON eth.state_cids USING btree (block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -938,13 +716,6 @@ CREATE INDEX state_header_id_index ON eth.state_cids USING btree (header_id);
|
|||||||
CREATE INDEX state_leaf_key_block_number_index ON eth.state_cids USING btree (state_leaf_key, block_number DESC);
|
CREATE INDEX state_leaf_key_block_number_index ON eth.state_cids USING btree (state_leaf_key, block_number DESC);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: state_partial_path_index; Type: INDEX; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX state_partial_path_index ON eth.state_cids USING btree (partial_path);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: state_removed_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: state_removed_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
@ -963,7 +734,7 @@ CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
|
|||||||
-- Name: storage_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: storage_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX storage_block_number_index ON eth.storage_cids USING brin (block_number);
|
CREATE INDEX storage_block_number_index ON eth.storage_cids USING btree (block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -987,13 +758,6 @@ CREATE INDEX storage_header_id_index ON eth.storage_cids USING btree (header_id)
|
|||||||
CREATE INDEX storage_leaf_key_block_number_index ON eth.storage_cids USING btree (storage_leaf_key, block_number DESC);
|
CREATE INDEX storage_leaf_key_block_number_index ON eth.storage_cids USING btree (storage_leaf_key, block_number DESC);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: storage_partial_path_index; Type: INDEX; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX storage_partial_path_index ON eth.storage_cids USING btree (partial_path);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: storage_removed_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: storage_removed_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
@ -1012,14 +776,14 @@ CREATE INDEX storage_state_leaf_key_index ON eth.storage_cids USING btree (state
|
|||||||
-- Name: timestamp_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: timestamp_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX timestamp_index ON eth.header_cids USING brin ("timestamp");
|
CREATE INDEX timestamp_index ON eth.header_cids USING btree ("timestamp");
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: tx_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: tx_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX tx_block_number_index ON eth.transaction_cids USING brin (block_number);
|
CREATE INDEX tx_block_number_index ON eth.transaction_cids USING btree (block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1054,7 +818,7 @@ CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src);
|
|||||||
-- Name: uncle_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
-- Name: uncle_block_number_index; Type: INDEX; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE INDEX uncle_block_number_index ON eth.uncle_cids USING brin (block_number);
|
CREATE INDEX uncle_block_number_index ON eth.uncle_cids USING btree (block_number);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1078,62 +842,6 @@ CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
|
|||||||
CREATE INDEX blocks_block_number_idx ON ipld.blocks USING btree (block_number DESC);
|
CREATE INDEX blocks_block_number_idx ON ipld.blocks USING btree (block_number DESC);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: access_list_elements trg_eth_access_list_elements; Type: TRIGGER; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_access_list_elements AFTER INSERT ON eth.access_list_elements FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription();
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: header_cids trg_eth_header_cids; Type: TRIGGER; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_header_cids AFTER INSERT ON eth.header_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription();
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: log_cids trg_eth_log_cids; Type: TRIGGER; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_log_cids AFTER INSERT ON eth.log_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription();
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: receipt_cids trg_eth_receipt_cids; Type: TRIGGER; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_receipt_cids AFTER INSERT ON eth.receipt_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription();
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: state_cids trg_eth_state_cids; Type: TRIGGER; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_state_cids AFTER INSERT ON eth.state_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription();
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: storage_cids trg_eth_storage_cids; Type: TRIGGER; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_storage_cids AFTER INSERT ON eth.storage_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription();
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: transaction_cids trg_eth_transaction_cids; Type: TRIGGER; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_transaction_cids AFTER INSERT ON eth.transaction_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription();
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: uncle_cids trg_eth_uncle_cids; Type: TRIGGER; Schema: eth; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TRIGGER trg_eth_uncle_cids AFTER INSERT ON eth.uncle_cids FOR EACH ROW EXECUTE FUNCTION eth.graphql_subscription();
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: access_list_elements ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
-- Name: access_list_elements ts_insert_blocker; Type: TRIGGER; Schema: eth; Owner: -
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user