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