Skip to content

Commit

Permalink
re-add id & block_id
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Dec 1, 2023
1 parent 46c4904 commit 797861a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/clickhouse/handleSinkRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ function insertEntityChange(
values: Record<string, unknown>,
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

Expand Down
2 changes: 2 additions & 0 deletions src/clickhouse/table-initialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export async function initializeDefaultTables(): Promise<Result> {
}

const extraColumns = [
"id String",
"chain LowCardinality(String)",
"block_number UInt32",
"block_id FixedString(64)",
"module_hash FixedString(40)",
"timestamp DateTime64(3, 'UTC')",
];
Expand Down

0 comments on commit 797861a

Please sign in to comment.