Skip to content

Commit 61d5b68

Browse files
authored
Remove database prefixes from ClickHouse table creation scripts (#83)
### TL;DR Removed database prefixes from table names in ClickHouse SQL scripts and updated engine type for logs table. ### What changed? - Removed database prefixes (`orchestrator.`, `base.`, and `staging.`) from all table names in ClickHouse SQL creation scripts. - Changed the engine for the `logs` table from `SharedReplacingMergeTree` to `ReplacingMergeTree`. Shared is only available in hosted version and will be applied automatically if you create a ReplacingMergeTree ### How to test? 1. Execute the updated SQL scripts in a ClickHouse environment. 2. Verify that tables are created without database prefixes. 3. Confirm that the `logs` table is created with the `ReplacingMergeTree` engine. 4. Ensure that all other table structures and settings remain unchanged. ### Why make this change? - Removing database prefixes allows for more flexibility in table placement and database organization. We don't want to enforce if these tables are used in one database or several
2 parents 5bd1700 + e87974d commit 61d5b68

6 files changed

+7
-7
lines changed

internal/tools/clickhouse_create_block_failures_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE orchestrator.block_failures (
1+
CREATE TABLE block_failures (
22
`chain_id` UInt256,
33
`block_number` UInt256,
44
`last_error_timestamp` UInt64 CODEC(Delta, ZSTD),

internal/tools/clickhouse_create_blocks_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE base.blocks (
1+
CREATE TABLE blocks (
22
`chain_id` UInt256,
33
`number` UInt256,
44
`timestamp` UInt64 CODEC(Delta, ZSTD),

internal/tools/clickhouse_create_logs_table.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE base.logs (
1+
CREATE TABLE logs (
22
`chain_id` UInt256,
33
`block_number` UInt256,
44
`block_hash` FixedString(66),
@@ -19,6 +19,6 @@ CREATE TABLE base.logs (
1919
INDEX idx_block_hash block_hash TYPE bloom_filter GRANULARITY 1,
2020
INDEX idx_address address TYPE bloom_filter GRANULARITY 1,
2121
INDEX idx_topic0 topic_0 TYPE bloom_filter GRANULARITY 1,
22-
) ENGINE = SharedReplacingMergeTree(insert_timestamp, is_deleted)
22+
) ENGINE = ReplacingMergeTree(insert_timestamp, is_deleted)
2323
ORDER BY (chain_id, transaction_hash, log_index, block_hash)
2424
SETTINGS allow_experimental_replacing_merge_with_cleanup = 1;

internal/tools/clickhouse_create_staging_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE staging.block_data (
1+
CREATE TABLE block_data (
22
`chain_id` UInt256,
33
`block_number` UInt256,
44
`data` String,

internal/tools/clickhouse_create_traces_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE base.traces (
1+
CREATE TABLE traces (
22
`chain_id` UInt256,
33
`block_number` UInt256,
44
`block_hash` FixedString(66),

internal/tools/clickhouse_create_transactions_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE base.transactions (
1+
CREATE TABLE transactions (
22
`chain_id` UInt256,
33
`hash` FixedString(66),
44
`nonce` UInt64,

0 commit comments

Comments
 (0)