2019-01-22 12:15:29 +00:00
|
|
|
-- +goose Up
|
2019-08-27 21:30:50 +00:00
|
|
|
CREATE TABLE public.headers
|
|
|
|
(
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
hash VARCHAR(66),
|
|
|
|
block_number BIGINT,
|
|
|
|
raw JSONB,
|
|
|
|
block_timestamp NUMERIC,
|
|
|
|
check_count INTEGER NOT NULL DEFAULT 0,
|
2020-02-10 15:00:55 +00:00
|
|
|
node_id INTEGER NOT NULL REFERENCES nodes (id) ON DELETE CASCADE,
|
2019-09-26 18:58:48 +00:00
|
|
|
eth_node_fingerprint VARCHAR(128),
|
|
|
|
UNIQUE (block_number, hash, eth_node_fingerprint)
|
2019-01-22 12:15:29 +00:00
|
|
|
);
|
|
|
|
|
2019-06-19 19:59:21 +00:00
|
|
|
CREATE INDEX headers_block_number
|
|
|
|
ON public.headers (block_number);
|
2019-03-05 10:52:38 +00:00
|
|
|
|
2019-06-19 19:59:21 +00:00
|
|
|
CREATE INDEX headers_block_timestamp
|
|
|
|
ON public.headers (block_timestamp);
|
2019-01-22 14:07:11 +00:00
|
|
|
|
2019-01-22 12:15:29 +00:00
|
|
|
-- +goose Down
|
2019-06-19 19:59:21 +00:00
|
|
|
DROP INDEX public.headers_block_number;
|
|
|
|
DROP INDEX public.headers_block_timestamp;
|
|
|
|
|
2019-01-22 14:07:11 +00:00
|
|
|
DROP TABLE public.headers;
|