diff --git a/db/migrations/00004_create_eth_header_cids_table.sql b/db/migrations/00004_create_eth_header_cids_table.sql index 6e8851d..d1967ba 100644 --- a/db/migrations/00004_create_eth_header_cids_table.sql +++ b/db/migrations/00004_create_eth_header_cids_table.sql @@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS eth.header_cids ( timestamp BIGINT NOT NULL, coinbase VARCHAR(66) NOT NULL, canonical BOOLEAN NOT NULL DEFAULT TRUE, + withdrawals_root VARCHAR(66) NOT NULL, PRIMARY KEY (block_hash, block_number) ); diff --git a/db/migrations/00021_create_eth_withdrawal_cids_table.sql b/db/migrations/00021_create_eth_withdrawal_cids_table.sql new file mode 100644 index 0000000..8f2ecec --- /dev/null +++ b/db/migrations/00021_create_eth_withdrawal_cids_table.sql @@ -0,0 +1,16 @@ +-- +goose Up +CREATE TABLE IF NOT EXISTS eth.withdrawal_cids ( + block_number BIGINT NOT NULL, + header_id VARCHAR(66) NOT NULL, + cid TEXT NOT NULL, + index INTEGER NOT NULL, + validator INTEGER NOT NULL, + address VARCHAR(66) NOT NULL, + amount NUMERIC NOT NULL, + PRIMARY KEY (index, header_id, block_number) +); + +SELECT create_hypertable('eth.withdrawal_cids', 'block_number', migrate_data => true, chunk_time_interval => 32768); + +-- +goose Down +DROP TABLE eth.withdrawal_cids;