From 797861a6bb835fe9aea52bda8086dd8b48473e80 Mon Sep 17 00:00:00 2001 From: Denis Carriere Date: Thu, 30 Nov 2023 22:16:32 -0500 Subject: [PATCH] re-add id & block_id --- src/clickhouse/handleSinkRequest.ts | 4 +++- src/clickhouse/table-initialization.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/clickhouse/handleSinkRequest.ts b/src/clickhouse/handleSinkRequest.ts index 42d36f0..259d072 100644 --- a/src/clickhouse/handleSinkRequest.ts +++ b/src/clickhouse/handleSinkRequest.ts @@ -148,8 +148,10 @@ function insertEntityChange( values: Record, metadata: { id: string; clock: Clock; manifest: Manifest; cursor: string } ) { + values["id"] = metadata.id; // Entity ID + values["block_id"] = metadata.clock.id; // Block Index values["chain"] = metadata.manifest.chain; - values["block_number"] = metadata.clock.number; + values["block_number"] = metadata.clock.number; // Block Number values["module_hash"] = metadata.manifest.moduleHash; values["timestamp"] = Number(new Date(metadata.clock.timestamp)); // Block timestamp diff --git a/src/clickhouse/table-initialization.ts b/src/clickhouse/table-initialization.ts index eb3c97c..75186f9 100644 --- a/src/clickhouse/table-initialization.ts +++ b/src/clickhouse/table-initialization.ts @@ -23,8 +23,10 @@ export async function initializeDefaultTables(): Promise { } const extraColumns = [ + "id String", "chain LowCardinality(String)", "block_number UInt32", + "block_id FixedString(64)", "module_hash FixedString(40)", "timestamp DateTime64(3, 'UTC')", ];