split uncles into their own table; add tx index to the tx index (lol); continue work on geth api endpoints

This commit is contained in:
Ian Norden
2020-01-27 14:14:03 -06:00
parent e52284b9ba
commit 33ac5978f5
21 changed files with 605 additions and 83 deletions
@@ -5,7 +5,6 @@ CREATE TABLE public.header_cids (
block_hash VARCHAR(66) NOT NULL,
parent_hash VARCHAR(66) NOT NULL,
cid TEXT NOT NULL,
uncle BOOLEAN NOT NULL,
td BIGINT,
UNIQUE (block_number, block_hash)
);
@@ -0,0 +1,12 @@
-- +goose Up
CREATE TABLE public.uncle_cids (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
block_hash VARCHAR(66) NOT NULL,
parent_hash VARCHAR(66) NOT NULL,
cid TEXT NOT NULL,
UNIQUE (header_id, block_hash)
);
-- +goose Down
DROP TABLE public.uncle_cids;
@@ -3,6 +3,7 @@ CREATE TABLE public.transaction_cids (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
tx_hash VARCHAR(66) NOT NULL,
index INTEGER NOT NULL,
cid TEXT NOT NULL,
dst VARCHAR(66) NOT NULL,
src VARCHAR(66) NOT NULL,