From 4939e7784ad6792a763bbf3e5ae98393da7e5692 Mon Sep 17 00:00:00 2001 From: ramil Date: Mon, 25 Jan 2021 23:12:10 +0300 Subject: [PATCH] get header by block number --- db/migrations/00018_ethHeaderCidByBlockNumber.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrations/00018_ethHeaderCidByBlockNumber.sql diff --git a/db/migrations/00018_ethHeaderCidByBlockNumber.sql b/db/migrations/00018_ethHeaderCidByBlockNumber.sql new file mode 100644 index 0000000..2f448e5 --- /dev/null +++ b/db/migrations/00018_ethHeaderCidByBlockNumber.sql @@ -0,0 +1,11 @@ +-- +goose Up +CREATE FUNCTION "ethHeaderCidByBlockNumber"(n bigint) returns SETOF eth.header_cids + stable + language sql +as +$$ +SELECT * FROM eth.header_cids WHERE block_number=$1 ORDER BY id +$$; + +-- +goose Down +DROP FUNCTION "ethHeaderCidByBlockNumber"(bigint); \ No newline at end of file