update pre- and post- sets

This commit is contained in:
i-norden 2022-03-21 19:53:48 -05:00
parent 1dc12460dc
commit ba2550cc01
28 changed files with 70 additions and 45 deletions

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE nodes ( CREATE TABLE IF NOT EXISTS nodes (
genesis_block VARCHAR(66), genesis_block VARCHAR(66),
network_id VARCHAR, network_id VARCHAR,
node_id VARCHAR(128) PRIMARY KEY, node_id VARCHAR(128) PRIMARY KEY,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.header_cids ( CREATE TABLE IF NOT EXISTS eth.header_cids (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
block_hash VARCHAR(66) PRIMARY KEY, block_hash VARCHAR(66) PRIMARY KEY,
parent_hash VARCHAR(66) NOT NULL, parent_hash VARCHAR(66) NOT NULL,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.uncle_cids ( CREATE TABLE IF NOT EXISTS eth.uncle_cids (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
block_hash VARCHAR(66) PRIMARY KEY, block_hash VARCHAR(66) PRIMARY KEY,
header_id VARCHAR(66) NOT NULL REFERENCES eth.header_cids (block_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, header_id VARCHAR(66) NOT NULL REFERENCES eth.header_cids (block_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.transaction_cids ( CREATE TABLE IF NOT EXISTS eth.transaction_cids (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL REFERENCES eth.header_cids (block_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, header_id VARCHAR(66) NOT NULL REFERENCES eth.header_cids (block_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
tx_hash VARCHAR(66) PRIMARY KEY, tx_hash VARCHAR(66) PRIMARY KEY,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.receipt_cids ( CREATE TABLE IF NOT EXISTS eth.receipt_cids (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
tx_id VARCHAR(66) PRIMARY KEY REFERENCES eth.transaction_cids (tx_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, tx_id VARCHAR(66) PRIMARY KEY REFERENCES eth.transaction_cids (tx_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
leaf_cid TEXT NOT NULL, leaf_cid TEXT NOT NULL,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.state_cids ( CREATE TABLE IF NOT EXISTS eth.state_cids (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL REFERENCES eth.header_cids (block_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, header_id VARCHAR(66) NOT NULL REFERENCES eth.header_cids (block_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
state_leaf_key VARCHAR(66), state_leaf_key VARCHAR(66),

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.storage_cids ( CREATE TABLE IF NOT EXISTS eth.storage_cids (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL, header_id VARCHAR(66) NOT NULL,
state_path BYTEA NOT NULL, state_path BYTEA NOT NULL,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.state_accounts ( CREATE TABLE IF NOT EXISTS eth.state_accounts (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL, header_id VARCHAR(66) NOT NULL,
state_path BYTEA NOT NULL, state_path BYTEA NOT NULL,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.access_list_elements ( CREATE TABLE IF NOT EXISTS eth.access_list_elements (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
tx_id VARCHAR(66) NOT NULL REFERENCES eth.transaction_cids (tx_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, tx_id VARCHAR(66) NOT NULL REFERENCES eth.transaction_cids (tx_hash) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
index INTEGER NOT NULL, index INTEGER NOT NULL,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.log_cids ( CREATE TABLE IF NOT EXISTS eth.log_cids (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
leaf_cid TEXT NOT NULL, leaf_cid TEXT NOT NULL,
leaf_mh_key TEXT NOT NULL, leaf_mh_key TEXT NOT NULL,

View File

@ -1,6 +1,6 @@
-- +goose Up -- +goose Up
ALTER TABLE public.blocks ALTER TABLE public.blocks
ADD CONSTRAINT pk_public_blocks PRIMARY KEY (key); ADD CONSTRAINT pk_public_blocks PRIMARY KEY (key, block_number);
-- +goose Down -- +goose Down
ALTER TABLE public.blocks ALTER TABLE public.blocks

View File

@ -1,7 +1,7 @@
-- +goose Up -- +goose Up
ALTER TABLE eth.log_cids ALTER TABLE eth.log_cids
ADD CONSTRAINT fk_log_leaf_mh_key ADD CONSTRAINT fk_log_leaf_mh_key
FOREIGN KEY (leaf_mh_key) REFERENCES public.blocks (key) FOREIGN KEY (leaf_mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
-- +goose Down -- +goose Down

View File

@ -27,7 +27,7 @@ DROP CONSTRAINT fk_log_leaf_mh_key;
-- +goose Down -- +goose Down
ALTER TABLE eth.log_cids ALTER TABLE eth.log_cids
ADD CONSTRAINT fk_log_leaf_mh_key ADD CONSTRAINT fk_log_leaf_mh_key
FOREIGN KEY (leaf_mh_key) REFERENCES public.blocks (key) FOREIGN KEY (leaf_mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
UPDATE pg_index UPDATE pg_index

View File

@ -1,7 +1,7 @@
-- +goose Up -- +goose Up
ALTER TABLE eth.header_cids ALTER TABLE eth.header_cids
ADD CONSTRAINT fk_header_mh_key ADD CONSTRAINT fk_header_mh_key
FOREIGN KEY (mh_key) REFERENCES public.blocks (key) FOREIGN KEY (mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE eth.header_cids ALTER TABLE eth.header_cids
@ -11,7 +11,7 @@ ADD CONSTRAINT fk_header_node_id
ALTER TABLE eth.uncle_cids ALTER TABLE eth.uncle_cids
ADD CONSTRAINT fk_uncle_mh_key ADD CONSTRAINT fk_uncle_mh_key
FOREIGN KEY (mh_key) REFERENCES public.blocks (key) FOREIGN KEY (mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE eth.uncle_cids ALTER TABLE eth.uncle_cids
@ -21,7 +21,7 @@ ADD CONSTRAINT fk_uncle_header_id
ALTER TABLE eth.transaction_cids ALTER TABLE eth.transaction_cids
ADD CONSTRAINT fk_tx_mh_key ADD CONSTRAINT fk_tx_mh_key
FOREIGN KEY (mh_key) REFERENCES public.blocks (key) FOREIGN KEY (mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE eth.transaction_cids ALTER TABLE eth.transaction_cids
@ -31,7 +31,7 @@ ADD CONSTRAINT fk_tx_header_id
ALTER TABLE eth.receipt_cids ALTER TABLE eth.receipt_cids
ADD CONSTRAINT fk_rct_leaf_mh_key ADD CONSTRAINT fk_rct_leaf_mh_key
FOREIGN KEY (leaf_mh_key) REFERENCES public.blocks (key) FOREIGN KEY (leaf_mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE eth.receipt_cids ALTER TABLE eth.receipt_cids
@ -41,7 +41,7 @@ ADD CONSTRAINT fk_rct_tx_id
ALTER TABLE eth.state_cids ALTER TABLE eth.state_cids
ADD CONSTRAINT fk_state_mh_key ADD CONSTRAINT fk_state_mh_key
FOREIGN KEY (mh_key) REFERENCES public.blocks (key) FOREIGN KEY (mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE eth.state_cids ALTER TABLE eth.state_cids
@ -51,7 +51,7 @@ ADD CONSTRAINT fk_state_header_id
ALTER TABLE eth.storage_cids ALTER TABLE eth.storage_cids
ADD CONSTRAINT fk_storage_mh_key ADD CONSTRAINT fk_storage_mh_key
FOREIGN KEY (mh_key) REFERENCES public.blocks (key) FOREIGN KEY (mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE eth.storage_cids ALTER TABLE eth.storage_cids
@ -71,7 +71,7 @@ ADD CONSTRAINT fk_access_list_tx_id
ALTER TABLE eth.log_cids ALTER TABLE eth.log_cids
ADD CONSTRAINT fk_log_leaf_mh_key ADD CONSTRAINT fk_log_leaf_mh_key
FOREIGN KEY (leaf_mh_key) REFERENCES public.blocks (key) FOREIGN KEY (leaf_mh_key, block_number) REFERENCES public.blocks (key, block_number)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE eth.log_cids ALTER TABLE eth.log_cids

View File

@ -1,15 +1,17 @@
-- +goose Up -- +goose Up
-- header indexes -- header indexes
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number); CREATE INDEX header_block_number_index ON eth.header_cids USING brin (block_number);
CREATE UNIQUE INDEX header_cid_index ON eth.header_cids USING btree (cid); CREATE UNIQUE INDEX header_cid_index ON eth.header_cids USING btree (cid);
CREATE UNIQUE INDEX header_mh_index ON eth.header_cids USING btree (mh_key); CREATE UNIQUE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
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 brin (timestamp);
-- uncle indexes -- uncle indexes
CREATE INDEX uncle_block_number_index ON eth.uncle_cids USING brin (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_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 UNIQUE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid); CREATE UNIQUE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
CREATE UNIQUE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key); CREATE UNIQUE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
@ -17,12 +19,14 @@ 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_leaf_cid_index ON eth.receipt_cids USING btree (leaf_cid); CREATE INDEX rct_leaf_cid_index ON eth.receipt_cids USING btree (leaf_cid);
CREATE INDEX rct_leaf_mh_index ON eth.receipt_cids USING btree (leaf_mh_key); CREATE INDEX rct_leaf_mh_index ON eth.receipt_cids USING btree (leaf_mh_key);
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); 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_leaf_key_index ON eth.state_cids USING btree (state_leaf_key); CREATE INDEX state_leaf_key_index ON eth.state_cids USING btree (state_leaf_key);
CREATE INDEX state_cid_index ON eth.state_cids USING btree (cid); CREATE INDEX state_cid_index ON eth.state_cids USING btree (cid);
CREATE INDEX state_mh_index ON eth.state_cids USING btree (mh_key); CREATE INDEX state_mh_index ON eth.state_cids USING btree (mh_key);
@ -30,6 +34,7 @@ CREATE INDEX state_path_index ON eth.state_cids USING btree (state_path);
CREATE INDEX state_node_type_index ON eth.state_cids USING btree (node_type); CREATE INDEX state_node_type_index ON eth.state_cids USING btree (node_type);
-- storage node indexes -- storage node indexes
CREATE INDEX storage_block_number_index ON eth.storage_cids USING brin (block_number);
CREATE INDEX storage_state_path_index ON eth.storage_cids USING btree (state_path); CREATE INDEX storage_state_path_index ON eth.storage_cids USING btree (state_path);
CREATE INDEX storage_leaf_key_index ON eth.storage_cids USING btree (storage_leaf_key); CREATE INDEX storage_leaf_key_index ON eth.storage_cids USING btree (storage_leaf_key);
CREATE INDEX storage_cid_index ON eth.storage_cids USING btree (cid); CREATE INDEX storage_cid_index ON eth.storage_cids USING btree (cid);
@ -38,14 +43,17 @@ CREATE INDEX storage_path_index ON eth.storage_cids USING btree (storage_path);
CREATE INDEX storage_node_type_index ON eth.storage_cids USING btree (node_type); CREATE INDEX storage_node_type_index ON eth.storage_cids USING btree (node_type);
-- state accounts indexes -- state accounts indexes
CREATE INDEX account_block_number_index ON eth.state_accounts USING brin (block_number);
CREATE INDEX account_state_path_index ON eth.state_accounts USING btree (state_path); CREATE INDEX account_state_path_index ON eth.state_accounts USING btree (state_path);
CREATE INDEX storage_root_index ON eth.state_accounts USING btree (storage_root); CREATE INDEX storage_root_index ON eth.state_accounts USING btree (storage_root);
-- 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_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_cid_index ON eth.log_cids USING btree (leaf_cid); CREATE INDEX log_cid_index ON eth.log_cids USING btree (leaf_cid);
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key); CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
CREATE INDEX log_address_index ON eth.log_cids USING btree (address); CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
@ -63,14 +71,17 @@ DROP INDEX eth.log_topic0_index;
DROP INDEX eth.log_address_index; DROP INDEX eth.log_address_index;
DROP INDEX eth.log_mh_index; DROP INDEX eth.log_mh_index;
DROP INDEX eth.log_cid_index; DROP INDEX eth.log_cid_index;
DROP INDEX eth.log_block_number_index;
-- access list indexes -- access list indexes
DROP INDEX eth.access_list_storage_keys_index; DROP INDEX eth.access_list_storage_keys_index;
DROP INDEX eth.access_list_element_address_index; DROP INDEX eth.access_list_element_address_index;
DROP INDEX eth.access_list_block_number_index;
-- state account indexes -- state account indexes
DROP INDEX eth.storage_root_index; DROP INDEX eth.storage_root_index;
DROP index eth.account_state_path_index; DROP index eth.account_state_path_index;
DROP INDEX eth.account_block_number_index;
-- storage node indexes -- storage node indexes
DROP INDEX eth.storage_node_type_index; DROP INDEX eth.storage_node_type_index;
@ -79,6 +90,7 @@ DROP INDEX eth.storage_mh_index;
DROP INDEX eth.storage_cid_index; DROP INDEX eth.storage_cid_index;
DROP INDEX eth.storage_leaf_key_index; DROP INDEX eth.storage_leaf_key_index;
DROP INDEX eth.storage_state_path_index; DROP INDEX eth.storage_state_path_index;
DROP INDEX eth.storage_block_number_index;
-- state node indexes -- state node indexes
DROP INDEX eth.state_node_type_index; DROP INDEX eth.state_node_type_index;
@ -86,12 +98,14 @@ DROP INDEX eth.state_path_index;
DROP INDEX eth.state_mh_index; DROP INDEX eth.state_mh_index;
DROP INDEX eth.state_cid_index; DROP INDEX eth.state_cid_index;
DROP INDEX eth.state_leaf_key_index; DROP INDEX eth.state_leaf_key_index;
DROP INDEX eth.state_block_number_index;
-- receipt indexes -- receipt indexes
DROP INDEX eth.rct_contract_hash_index; DROP INDEX eth.rct_contract_hash_index;
DROP INDEX eth.rct_contract_index; DROP INDEX eth.rct_contract_index;
DROP INDEX eth.rct_leaf_mh_index; DROP INDEX eth.rct_leaf_mh_index;
DROP INDEX eth.rct_leaf_cid_index; DROP INDEX eth.rct_leaf_cid_index;
DROP INDEX eth.rct_block_number_index;
-- transaction indexes -- transaction indexes
DROP INDEX eth.tx_src_index; DROP INDEX eth.tx_src_index;
@ -99,13 +113,15 @@ DROP INDEX eth.tx_dst_index;
DROP INDEX eth.tx_mh_index; DROP INDEX eth.tx_mh_index;
DROP INDEX eth.tx_cid_index; DROP INDEX eth.tx_cid_index;
DROP INDEX eth.tx_header_id_index; DROP INDEX eth.tx_header_id_index;
DROP INDEX eth.tx_block_number_index;
-- uncle indexes -- uncle indexes
DROP INDEX eth.uncle_header_id_index; DROP INDEX eth.uncle_header_id_index;
DROP INDEX eth.uncle_block_number_index;
-- header indexes -- header indexes
DROP INDEX eth.timestamp_index; DROP INDEX eth.timestamp_index;
DROP INDEX eth.state_root_index; DROP INDEX eth.state_root_index;
DROP INDEX eth.header_mh_index; DROP INDEX eth.header_mh_index;
DROP INDEX eth.header_cid_index; DROP INDEX eth.header_cid_index;
DROP INDEX eth.block_number_index; DROP INDEX eth.header_block_number_index;

View File

@ -7,10 +7,10 @@ CREATE OR REPLACE FUNCTION was_state_leaf_removed(key character varying, hash ch
FROM eth.state_cids FROM eth.state_cids
INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash) INNER JOIN eth.header_cids ON (state_cids.header_id = header_cids.block_hash)
WHERE state_leaf_key = key WHERE state_leaf_key = key
AND block_number <= (SELECT block_number AND state_cids.block_number <= (SELECT block_number
FROM eth.header_cids FROM eth.header_cids
WHERE block_hash = hash) WHERE block_hash = hash)
ORDER BY block_number DESC LIMIT 1; ORDER BY state_cids.block_number DESC LIMIT 1;
$$ $$
language sql; language sql;
-- +goose StatementEnd -- +goose StatementEnd

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE IF NOT EXISTS public.blocks ( CREATE TABLE IF NOT EXISTS public.blocks (
block_number BIGINT NOT NULL,
key TEXT NOT NULL, key TEXT NOT NULL,
data BYTEA NOT NULL data BYTEA NOT NULL
); );

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE nodes ( CREATE TABLE IF NOT EXISTS nodes (
genesis_block VARCHAR(66), genesis_block VARCHAR(66),
network_id VARCHAR, network_id VARCHAR,
node_id VARCHAR(128) NOT NULL, node_id VARCHAR(128) NOT NULL,

View File

@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.header_cids ( CREATE TABLE IF NOT EXISTS eth.header_cids (
block_number BIGINT NOT NULL, block_number BIGINT NOT NULL,
block_hash VARCHAR(66) NOT NULL, block_hash VARCHAR(66) NOT NULL,
parent_hash VARCHAR(66) NOT NULL, parent_hash VARCHAR(66) NOT NULL,

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.uncle_cids ( CREATE TABLE IF NOT EXISTS eth.uncle_cids (
block_number BIGINT NOT NULL,
block_hash VARCHAR(66) NOT NULL, block_hash VARCHAR(66) NOT NULL,
header_id VARCHAR(66) NOT NULL, header_id VARCHAR(66) NOT NULL,
parent_hash VARCHAR(66) NOT NULL, parent_hash VARCHAR(66) NOT NULL,

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.transaction_cids ( CREATE TABLE IF NOT EXISTS eth.transaction_cids (
block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL, header_id VARCHAR(66) NOT NULL,
tx_hash VARCHAR(66) NOT NULL, tx_hash VARCHAR(66) NOT NULL,
cid TEXT NOT NULL, cid TEXT NOT NULL,

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.receipt_cids ( CREATE TABLE IF NOT EXISTS eth.receipt_cids (
block_number BIGINT NOT NULL,
tx_id VARCHAR(66) NOT NULL, tx_id VARCHAR(66) NOT NULL,
leaf_cid TEXT NOT NULL, leaf_cid TEXT NOT NULL,
contract VARCHAR(66), contract VARCHAR(66),

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.state_cids ( CREATE TABLE IF NOT EXISTS eth.state_cids (
block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL, header_id VARCHAR(66) NOT NULL,
state_leaf_key VARCHAR(66), state_leaf_key VARCHAR(66),
cid TEXT NOT NULL, cid TEXT NOT NULL,

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.storage_cids ( CREATE TABLE IF NOT EXISTS eth.storage_cids (
block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL, header_id VARCHAR(66) NOT NULL,
state_path BYTEA NOT NULL, state_path BYTEA NOT NULL,
storage_leaf_key VARCHAR(66), storage_leaf_key VARCHAR(66),

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.state_accounts ( CREATE TABLE IF NOT EXISTS eth.state_accounts (
block_number BIGINT NOT NULL,
header_id VARCHAR(66) NOT NULL, header_id VARCHAR(66) NOT NULL,
state_path BYTEA NOT NULL, state_path BYTEA NOT NULL,
balance NUMERIC NOT NULL, balance NUMERIC NOT NULL,

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.access_list_elements ( CREATE TABLE IF NOT EXISTS eth.access_list_elements (
block_number BIGINT NOT NULL,
tx_id VARCHAR(66) NOT NULL, tx_id VARCHAR(66) NOT NULL,
index INTEGER NOT NULL, index INTEGER NOT NULL,
address VARCHAR(66), address VARCHAR(66),

View File

@ -1,5 +1,6 @@
-- +goose Up -- +goose Up
CREATE TABLE eth.log_cids ( CREATE TABLE IF NOT EXISTS eth.log_cids (
block_number BIGINT NOT NULL,
leaf_cid TEXT NOT NULL, leaf_cid TEXT NOT NULL,
leaf_mh_key TEXT NOT NULL, leaf_mh_key TEXT NOT NULL,
rct_id VARCHAR(66) NOT NULL, rct_id VARCHAR(66) NOT NULL,