diff --git a/db/migrations/00001_create_ipfs_blocks_table.sql b/db/migrations/00001_create_ipfs_blocks_table.sql index 50a3b67..98a644d 100644 --- a/db/migrations/00001_create_ipfs_blocks_table.sql +++ b/db/migrations/00001_create_ipfs_blocks_table.sql @@ -1,7 +1,7 @@ -- +goose Up CREATE TABLE IF NOT EXISTS public.blocks ( block_number BIGINT NOT NULL, - key TEXT NOT NULL, + cid TEXT NOT NULL, data BYTEA NOT NULL, PRIMARY KEY (key, block_number) ); diff --git a/db/migrations/00004_create_eth_header_cids_table.sql b/db/migrations/00004_create_eth_header_cids_table.sql index 5937785..90cb50a 100644 --- a/db/migrations/00004_create_eth_header_cids_table.sql +++ b/db/migrations/00004_create_eth_header_cids_table.sql @@ -13,7 +13,6 @@ CREATE TABLE IF NOT EXISTS eth.header_cids ( uncles_hash VARCHAR(66) NOT NULL, bloom BYTEA NOT NULL, timestamp BIGINT NOT NULL, - mh_key TEXT NOT NULL, coinbase VARCHAR(66) NOT NULL, PRIMARY KEY (block_hash, block_number) ); diff --git a/db/migrations/00005_create_eth_uncle_cids_table.sql b/db/migrations/00005_create_eth_uncle_cids_table.sql index 78764c6..6194cf3 100644 --- a/db/migrations/00005_create_eth_uncle_cids_table.sql +++ b/db/migrations/00005_create_eth_uncle_cids_table.sql @@ -6,7 +6,6 @@ CREATE TABLE IF NOT EXISTS eth.uncle_cids ( parent_hash VARCHAR(66) NOT NULL, cid TEXT NOT NULL, reward NUMERIC NOT NULL, - mh_key TEXT NOT NULL, PRIMARY KEY (block_hash, block_number) ); diff --git a/db/migrations/00006_create_eth_transaction_cids_table.sql b/db/migrations/00006_create_eth_transaction_cids_table.sql index 6bcd2dd..a6a3801 100644 --- a/db/migrations/00006_create_eth_transaction_cids_table.sql +++ b/db/migrations/00006_create_eth_transaction_cids_table.sql @@ -7,7 +7,6 @@ CREATE TABLE IF NOT EXISTS eth.transaction_cids ( dst VARCHAR(66), src VARCHAR(66) NOT NULL, index INTEGER NOT NULL, - mh_key TEXT NOT NULL, tx_type INTEGER, value NUMERIC, PRIMARY KEY (tx_hash, header_id, block_number) diff --git a/db/migrations/00007_create_eth_receipt_cids_table.sql b/db/migrations/00007_create_eth_receipt_cids_table.sql index 266da4b..3bc6f16 100644 --- a/db/migrations/00007_create_eth_receipt_cids_table.sql +++ b/db/migrations/00007_create_eth_receipt_cids_table.sql @@ -6,7 +6,6 @@ CREATE TABLE IF NOT EXISTS eth.receipt_cids ( cid TEXT NOT NULL, contract VARCHAR(66), contract_hash VARCHAR(66), - mh_key TEXT NOT NULL, post_state VARCHAR(66), post_status SMALLINT, PRIMARY KEY (tx_id, header_id, block_number) diff --git a/db/migrations/00008_create_eth_state_cids_table.sql b/db/migrations/00008_create_eth_state_cids_table.sql index da73717..98801b7 100644 --- a/db/migrations/00008_create_eth_state_cids_table.sql +++ b/db/migrations/00008_create_eth_state_cids_table.sql @@ -6,7 +6,6 @@ CREATE TABLE IF NOT EXISTS eth.state_cids ( cid TEXT NOT NULL, partial_path BYTEA NOT NULL, diff BOOLEAN NOT NULL DEFAULT FALSE, - mh_key TEXT NOT NULL, balance NUMERIC, -- NULL if "removed" nonce BIGINT, -- NULL if "removed" code_hash VARCHAR(66), -- NULL if "removed" diff --git a/db/migrations/00009_create_eth_storage_cids_table.sql b/db/migrations/00009_create_eth_storage_cids_table.sql index a42af46..d02c591 100644 --- a/db/migrations/00009_create_eth_storage_cids_table.sql +++ b/db/migrations/00009_create_eth_storage_cids_table.sql @@ -7,7 +7,6 @@ CREATE TABLE IF NOT EXISTS eth.storage_cids ( cid TEXT NOT NULL, partial_path BYTEA NOT NULL, diff BOOLEAN NOT NULL DEFAULT FALSE, - mh_key TEXT NOT NULL, val BYTEA, -- NULL if "removed" removed BOOLEAN NOT NULL, PRIMARY KEY (storage_leaf_key, state_leaf_key, header_id, block_number) diff --git a/db/migrations/00011_create_eth_log_cids_table.sql b/db/migrations/00011_create_eth_log_cids_table.sql index 4c27b27..b119a20 100644 --- a/db/migrations/00011_create_eth_log_cids_table.sql +++ b/db/migrations/00011_create_eth_log_cids_table.sql @@ -3,7 +3,6 @@ CREATE TABLE IF NOT EXISTS eth.log_cids ( block_number BIGINT NOT NULL, header_id VARCHAR(66) NOT NULL, cid TEXT NOT NULL, - mh_key TEXT NOT NULL, rct_id VARCHAR(66) NOT NULL, address VARCHAR(66) NOT NULL, index INTEGER NOT NULL, diff --git a/db/migrations/00014_create_cid_indexes.sql b/db/migrations/00014_create_cid_indexes.sql index a9b747b..8bd49ca 100644 --- a/db/migrations/00014_create_cid_indexes.sql +++ b/db/migrations/00014_create_cid_indexes.sql @@ -1,36 +1,32 @@ -- +goose Up -- header indexes 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, block_number); -CREATE UNIQUE INDEX header_mh_block_number_index ON eth.header_cids USING btree (mh_key, 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 timestamp_index ON eth.header_cids USING brin (timestamp); -- uncle indexes CREATE INDEX uncle_block_number_index ON eth.uncle_cids USING brin (block_number); -CREATE UNIQUE INDEX uncle_mh_block_number_index ON eth.uncle_cids USING btree (mh_key, 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); -- 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_cid_index ON eth.transaction_cids USING btree (cid, block_number); -CREATE INDEX tx_mh_block_number_index ON eth.transaction_cids USING btree (mh_key, 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_src_index ON eth.transaction_cids USING btree (src); -- receipt indexes CREATE INDEX rct_block_number_index ON eth.receipt_cids USING brin (block_number); CREATE INDEX rct_header_id_index ON eth.receipt_cids USING btree (header_id); -CREATE INDEX rct_cid_index ON eth.receipt_cids USING btree (cid); -CREATE INDEX rct_mh_block_number_index ON eth.receipt_cids USING btree (mh_key, 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_hash_index ON eth.receipt_cids USING btree (contract_hash); -- state node indexes CREATE INDEX state_block_number_index ON eth.state_cids USING brin (block_number); -CREATE INDEX state_cid_index ON eth.state_cids USING btree (cid); -CREATE INDEX state_mh_block_number_index ON eth.state_cids USING btree (mh_key, 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_path_index ON eth.state_cids USING btree (state_path); CREATE INDEX state_removed_index ON eth.state_cids USING btree (removed); @@ -40,8 +36,7 @@ CREATE INDEX state_leaf_key_block_number_index ON eth.state_cids(state_leaf_key, -- storage node indexes CREATE INDEX storage_block_number_index ON eth.storage_cids USING brin (block_number); CREATE INDEX storage_state_leaf_key_index ON eth.storage_cids USING btree (state_leaf_key); -CREATE INDEX storage_cid_index ON eth.storage_cids USING btree (cid); -CREATE INDEX storage_mh_block_number_index ON eth.storage_cids USING btree (mh_key, 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_path_index ON eth.storage_cids USING btree (storage_path); CREATE INDEX storage_removed_index ON eth.storage_cids USING btree (removed); @@ -55,8 +50,7 @@ CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gi -- log indexes CREATE INDEX log_block_number_index ON eth.log_cids USING brin (block_number); CREATE INDEX log_header_id_index ON eth.log_cids USING btree (header_id); -CREATE INDEX log_mh_block_number_index ON eth.log_cids USING btree (mh_key, block_number); -CREATE INDEX log_cid_index ON eth.log_cids USING btree (cid); +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_topic0_index ON eth.log_cids USING btree (topic0); CREATE INDEX log_topic1_index ON eth.log_cids USING btree (topic1); @@ -70,8 +64,7 @@ DROP INDEX eth.log_topic2_index; DROP INDEX eth.log_topic1_index; DROP INDEX eth.log_topic0_index; DROP INDEX eth.log_address_index; -DROP INDEX eth.log_cid_index; -DROP INDEX eth.log_mh_block_number_index; +DROP INDEX eth.log_cid_block_number_index; DROP INDEX eth.log_header_id_index; DROP INDEX eth.log_block_number_index; @@ -84,8 +77,7 @@ DROP INDEX eth.access_list_block_number_index; DROP INDEX eth.storage_removed_index; DROP INDEX eth.storage_path_index; DROP INDEX eth.storage_header_id_index; -DROP INDEX eth.storage_mh_block_number_index; -DROP INDEX eth.storage_cid_index; +DROP INDEX eth.storage_cid_block_number_index; DROP INDEX eth.storage_leaf_key_index; DROP INDEX eth.storage_state_leaf_key_index; DROP INDEX eth.storage_block_number_index; @@ -96,35 +88,31 @@ DROP INDEX eth.state_code_hash_index; DROP INDEX eth.state_removed_index; DROP INDEX eth.state_path_index; DROP INDEX eth.state_header_id_index; -DROP INDEX eth.state_mh_block_number_index; -DROP INDEX eth.state_cid_index; +DROP INDEX eth.state_cid_block_number_index; DROP INDEX eth.state_block_number_index; DROP INDEX eth.state_leaf_key_block_number_index; -- receipt indexes DROP INDEX eth.rct_contract_hash_index; DROP INDEX eth.rct_contract_index; -DROP INDEX eth.rct_mh_block_number_index; -DROP INDEX eth.rct_cid_index; +DROP INDEX eth.rct_cid_block_number_index; DROP INDEX eth.rct_header_id_index; DROP INDEX eth.rct_block_number_index; -- transaction indexes DROP INDEX eth.tx_src_index; DROP INDEX eth.tx_dst_index; -DROP INDEX eth.tx_mh_block_number_index; -DROP INDEX eth.tx_cid_index; +DROP INDEX eth.tx_cid_block_number_index; DROP INDEX eth.tx_header_id_index; DROP INDEX eth.tx_block_number_index; -- uncle indexes DROP INDEX eth.uncle_block_number_index; -DROP INDEX eth.uncle_mh_block_number_index; +DROP INDEX eth.uncle_cid_block_number_index; DROP INDEX eth.uncle_header_id_index; -- header indexes DROP INDEX eth.timestamp_index; DROP INDEX eth.state_root_index; -DROP INDEX eth.header_mh_block_number_index; -DROP INDEX eth.header_cid_index; +DROP INDEX eth.header_cid_block_number_index; DROP INDEX eth.header_block_number_index;