Skip to content

Commit

Permalink
Fix missing quotes for cluster name in SQL schema
Browse files Browse the repository at this point in the history
  • Loading branch information
0237h committed Aug 19, 2024
1 parent 5d6eaf3 commit 924d012
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion create_schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ done
ON_CLUSTER_DIRECTIVE=""
ENGINE_TYPE="ReplacingMergeTree()"
if [ -n "$CLUSTER_NAME" ]; then
ON_CLUSTER_DIRECTIVE="ON CLUSTER $CLUSTER_NAME"
ON_CLUSTER_DIRECTIVE="ON CLUSTER \"$CLUSTER_NAME\""
ENGINE_TYPE="ReplicatedReplacingMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')"
fi

Expand Down
43 changes: 43 additions & 0 deletions schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,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 "antelope"
(
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 = ReplicatedReplacingMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')
PRIMARY KEY (contract, symcode, trx_id, action_index)
ORDER BY (contract, symcode, trx_id, action_index);

CREATE MATERIALIZED VIEW transfers_contract_mv ON CLUSTER "antelope"
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 "antelope"
(
Expand Down

0 comments on commit 924d012

Please sign in to comment.