From 265dc9feee032c199f5a4fd6dafada7907fbb175 Mon Sep 17 00:00:00 2001 From: ramil Date: Fri, 12 Feb 2021 19:27:15 +0300 Subject: [PATCH] VUL-234 create graphql method "graphCallByTxHash" --- db/migrations/00004_graph_call_by_tx_hash.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 db/migrations/00004_graph_call_by_tx_hash.sql diff --git a/db/migrations/00004_graph_call_by_tx_hash.sql b/db/migrations/00004_graph_call_by_tx_hash.sql new file mode 100644 index 0000000..d63d46c --- /dev/null +++ b/db/migrations/00004_graph_call_by_tx_hash.sql @@ -0,0 +1,23 @@ +-- +goose Up +CREATE FUNCTION "graphCallByTxHash"(txHash varchar(66)) returns SETOF RECORD + stable + language sql +as +$$ +SELECT + gt.block_number, + gt.block_hash, + gt.tx_hash, + gt.index, + gc.src, + gc.dst, + gc.input, + gc.output, + gc.value, + gc.gas_used +FROM trace.graph_transaction gt + INNER JOIN trace.graph_call gc ON (gc.transaction_id = gt.id) +WHERE gt.tx_hash = $1 +$$; +-- +goose Down +DROP FUNCTION "graphCallByTxHash"(varchar(66)); \ No newline at end of file