From eab70c0cbdc09d0c40b67514b98767896d870229 Mon Sep 17 00:00:00 2001 From: Etienne Donneger Date: Fri, 16 Aug 2024 15:55:53 +0000 Subject: [PATCH] Fix missing `transfers_contract` table from schema (#60) --- create_schema.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/create_schema.sh b/create_schema.sh index ae934d4..569b725 100755 --- a/create_schema.sh +++ b/create_schema.sh @@ -383,6 +383,49 @@ SELECT contract, timestamp AS updated_at_timestamp FROM supply_change_events; +-- Table to store token transfers primarily indexed by the 'contract' field -- +CREATE TABLE IF NOT EXISTS transfers_contract $ON_CLUSTER_DIRECTIVE +( + trx_id String, + action_index UInt32, + + contract String, + symcode String, + + from String, + to String, + quantity String, + memo String, + + precision UInt32, + amount Int64, + value Float64, + + block_num UInt64, + timestamp DateTime +) + ENGINE = $ENGINE_TYPE + PRIMARY KEY (contract, symcode, trx_id, action_index) + ORDER BY (contract, symcode, trx_id, action_index); + +CREATE MATERIALIZED VIEW transfers_contract_mv $ON_CLUSTER_DIRECTIVE + TO transfers_contract +AS +SELECT trx_id, + action_index, + contract, + symcode, + from, + to, + quantity, + memo, + precision, + amount, + value, + block_num, + timestamp +FROM transfer_events; + -- Table to store token transfers primarily indexed by the 'from' field -- CREATE TABLE IF NOT EXISTS transfers_from $ON_CLUSTER_DIRECTIVE (