Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: make migrations self-host replica compatible (#4287)

Steffen Schmitzf876cf6e3439
diff --git a/.env.dev.example b/.env.dev.example
index ce09d42075..6a3238ca34 100644
--- a/.env.dev.example
+++ b/.env.dev.example
@@ -11,6 +11,7 @@ CLICKHOUSE_MIGRATION_URL="clickhouse://localhost:9000"
CLICKHOUSE_URL="http://localhost:8123"
CLICKHOUSE_USER="clickhouse"
CLICKHOUSE_PASSWORD="clickhouse"
+CLICKHOUSE_MIGRATION_CLUSTER_DISABLED="true"
# Next Auth
# You can generate a new secret on the command line with:
diff --git a/.env.dev.legacy.example b/.env.dev.legacy.example
index 64a8168030..4e2cdb07b9 100644
--- a/.env.dev.legacy.example
+++ b/.env.dev.legacy.example
@@ -11,6 +11,7 @@ CLICKHOUSE_MIGRATION_URL="clickhouse://localhost:9000"
CLICKHOUSE_URL="http://localhost:8123"
CLICKHOUSE_USER="clickhouse"
CLICKHOUSE_PASSWORD="clickhouse"
+CLICKHOUSE_MIGRATION_CLUSTER_DISABLED="true"
# Next Auth
# You can generate a new secret on the command line with:
diff --git a/docker-compose.v3preview.yml b/docker-compose.v3preview.yml
index 35f89ba644..2496cf5328 100644
--- a/docker-compose.v3preview.yml
+++ b/docker-compose.v3preview.yml
@@ -25,6 +25,7 @@ services:
CLICKHOUSE_URL: ${CLICKHOUSE_URL:-http://clickhouse:8123}
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-clickhouse}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-clickhouse}
+ CLICKHOUSE_MIGRATION_CLUSTER_DISABLED: ${CLICKHOUSE_MIGRATION_CLUSTER_DISABLED:-true}
LANGFUSE_S3_EVENT_UPLOAD_ENABLED: ${LANGFUSE_S3_EVENT_UPLOAD_ENABLED:-true}
LANGFUSE_S3_EVENT_UPLOAD_BUCKET: ${LANGFUSE_S3_EVENT_UPLOAD_BUCKET:-langfuse}
LANGFUSE_S3_EVENT_UPLOAD_REGION: ${LANGFUSE_S3_EVENT_UPLOAD_REGION:-us-east-1}
diff --git a/packages/shared/clickhouse/migrations/clustered/0001_traces.down.sql b/packages/shared/clickhouse/migrations/clustered/0001_traces.down.sql
new file mode 100644
index 0000000000..eb7f439d49
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0001_traces.down.sql
@@ -0,0 +1 @@
+DROP TABLE traces ON CLUSTER default;
\ No newline at end of file
diff --git a/packages/shared/clickhouse/migrations/clustered/0001_traces.up.sql b/packages/shared/clickhouse/migrations/clustered/0001_traces.up.sql
new file mode 100644
index 0000000000..dee75a8f01
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0001_traces.up.sql
@@ -0,0 +1,32 @@
+CREATE TABLE traces ON CLUSTER default (
+ `id` String,
+ `timestamp` DateTime64(3),
+ `name` String,
+ `user_id` Nullable(String),
+ `metadata` Map(LowCardinality(String), String),
+ `release` Nullable(String),
+ `version` Nullable(String),
+ `project_id` String,
+ `public` Bool,
+ `bookmarked` Bool,
+ `tags` Array(String),
+ `input` Nullable(String) CODEC(ZSTD(3)),
+ `output` Nullable(String) CODEC(ZSTD(3)),
+ `session_id` Nullable(String),
+ `created_at` DateTime64(3) DEFAULT now(),
+ updated_at DateTime64(3) DEFAULT now(),
+ `event_ts` DateTime64(3),
+ `is_deleted` UInt8,
+ INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1,
+ INDEX idx_res_metadata_key mapKeys(metadata) TYPE bloom_filter(0.01) GRANULARITY 1,
+ INDEX idx_res_metadata_value mapValues(metadata) TYPE bloom_filter(0.01) GRANULARITY 1
+) ENGINE = ReplicatedReplacingMergeTree(event_ts, is_deleted) Partition by toYYYYMM(timestamp)
+PRIMARY KEY (
+ project_id,
+ toDate(timestamp)
+)
+ORDER BY (
+ project_id,
+ toDate(timestamp),
+ id
+);
diff --git a/packages/shared/clickhouse/migrations/clustered/0002_observations.down.sql b/packages/shared/clickhouse/migrations/clustered/0002_observations.down.sql
new file mode 100644
index 0000000000..e3aaa0066f
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0002_observations.down.sql
@@ -0,0 +1 @@
+DROP TABLE observations ON CLUSTER default;
\ No newline at end of file
diff --git a/packages/shared/clickhouse/migrations/clustered/0002_observations.up.sql b/packages/shared/clickhouse/migrations/clustered/0002_observations.up.sql
new file mode 100644
index 0000000000..14d2359815
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0002_observations.up.sql
@@ -0,0 +1,47 @@
+CREATE TABLE observations ON CLUSTER default (
+ `id` String,
+ `trace_id` String,
+ `project_id` String,
+ `type` LowCardinality(String),
+ `parent_observation_id` Nullable(String),
+ `start_time` DateTime64(3),
+ `end_time` Nullable(DateTime64(3)),
+ `name` String,
+ `metadata` Map(LowCardinality(String), String),
+ `level` LowCardinality(String),
+ `status_message` Nullable(String),
+ `version` Nullable(String),
+ `input` Nullable(String) CODEC(ZSTD(3)),
+ `output` Nullable(String) CODEC(ZSTD(3)),
+ `provided_model_name` Nullable(String),
+ `internal_model_id` Nullable(String),
+ `model_parameters` Nullable(String),
+ `provided_usage_details` Map(LowCardinality(String), UInt64),
+ `usage_details` Map(LowCardinality(String), UInt64),
+ `provided_cost_details` Map(LowCardinality(String), Decimal64(12)),
+ `cost_details` Map(LowCardinality(String), Decimal64(12)),
+ `total_cost` Nullable(Decimal64(12)),
+ `completion_start_time` Nullable(DateTime64(3)),
+ `prompt_id` Nullable(String),
+ `prompt_name` Nullable(String),
+ `prompt_version` Nullable(UInt16),
+ `created_at` DateTime64(3) DEFAULT now(),
+ `updated_at` DateTime64(3) DEFAULT now(),
+ event_ts DateTime64(3),
+ is_deleted UInt8,
+ INDEX idx_id id TYPE bloom_filter() GRANULARITY 1,
+ INDEX idx_trace_id trace_id TYPE bloom_filter() GRANULARITY 1,
+ INDEX idx_project_id project_id TYPE bloom_filter() GRANULARITY 1
+) ENGINE = ReplicatedReplacingMergeTree(event_ts, is_deleted) Partition by toYYYYMM(start_time)
+PRIMARY KEY (
+ project_id,
+ `type`,
+ toDate(start_time)
+)
+ORDER BY (
+ project_id,
+ `type`,
+ toDate(start_time),
+ id
+);
+
diff --git a/packages/shared/clickhouse/migrations/clustered/0003_scores.down.sql b/packages/shared/clickhouse/migrations/clustered/0003_scores.down.sql
new file mode 100644
index 0000000000..973a078d62
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0003_scores.down.sql
@@ -0,0 +1 @@
+DROP TABLE scores ON CLUSTER default;
\ No newline at end of file
diff --git a/packages/shared/clickhouse/migrations/clustered/0003_scores.up.sql b/packages/shared/clickhouse/migrations/clustered/0003_scores.up.sql
new file mode 100644
index 0000000000..3056924974
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0003_scores.up.sql
@@ -0,0 +1,33 @@
+CREATE TABLE scores ON CLUSTER default (
+ `id` String,
+ `timestamp` DateTime64(3),
+ `project_id` String,
+ `trace_id` String,
+ `observation_id` Nullable(String),
+ `name` String,
+ `value` Float64,
+ `source` String,
+ `comment` Nullable(String) CODEC(ZSTD(1)),
+ `author_user_id` Nullable(String),
+ `config_id` Nullable(String),
+ `data_type` String,
+ `string_value` Nullable(String),
+ `queue_id` Nullable(String),
+ `created_at` DateTime64(3) DEFAULT now(),
+ `updated_at` DateTime64(3) DEFAULT now(),
+ event_ts DateTime64(3),
+ `is_deleted` UInt8,
+ INDEX idx_id id TYPE bloom_filter(0.001) GRANULARITY 1,
+ INDEX idx_project_trace_observation (project_id, trace_id, observation_id) TYPE bloom_filter(0.001) GRANULARITY 1
+) ENGINE = ReplicatedReplacingMergeTree(event_ts, is_deleted) Partition by toYYYYMM(timestamp)
+PRIMARY KEY (
+ project_id,
+ toDate(timestamp),
+ name
+)
+ORDER BY (
+ project_id,
+ toDate(timestamp),
+ name,
+ id
+)
diff --git a/packages/shared/clickhouse/migrations/clustered/0004_drop_observations_index.down.sql b/packages/shared/clickhouse/migrations/clustered/0004_drop_observations_index.down.sql
new file mode 100644
index 0000000000..ea20f3d1b4
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0004_drop_observations_index.down.sql
@@ -0,0 +1 @@
+ALTER TABLE observations ON CLUSTER default ADD INDEX IF NOT EXISTS idx_project_id project_id TYPE bloom_filter() GRANULARITY 1;
\ No newline at end of file
diff --git a/packages/shared/clickhouse/migrations/clustered/0004_drop_observations_index.up.sql b/packages/shared/clickhouse/migrations/clustered/0004_drop_observations_index.up.sql
new file mode 100644
index 0000000000..990c0e21ea
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0004_drop_observations_index.up.sql
@@ -0,0 +1 @@
+ALTER TABLE observations ON CLUSTER default DROP INDEX IF EXISTS idx_project_id;
\ No newline at end of file
diff --git a/packages/shared/clickhouse/migrations/clustered/0005_add_session_id_index.down.sql b/packages/shared/clickhouse/migrations/clustered/0005_add_session_id_index.down.sql
new file mode 100644
index 0000000000..c9460635bd
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0005_add_session_id_index.down.sql
@@ -0,0 +1 @@
+ALTER TABLE traces ON CLUSTER default DROP INDEX IF EXISTS idx_session_id;
\ No newline at end of file
diff --git a/packages/shared/clickhouse/migrations/clustered/0005_add_session_id_index.up.sql b/packages/shared/clickhouse/migrations/clustered/0005_add_session_id_index.up.sql
new file mode 100644
index 0000000000..33563fd657
--- /dev/null
+++ b/packages/shared/clickhouse/migrations/clustered/0005_add_session_id_index.up.sql
@@ -0,0 +1,2 @@
+ALTER TABLE traces ON CLUSTER default ADD INDEX IF NOT EXISTS idx_session_id session_id TYPE bloom_filter() GRANULARITY 1;
+ALTER TABLE traces ON CLUSTER default MATERIALIZE INDEX IF EXISTS idx_session_id;
\ No newline at end of file
diff --git a/packages/shared/clickhouse/migrations/0001_traces.down.sql b/packages/shared/clickhouse/migrations/unclustered/0001_traces.down.sql
similarity index 100%
rename from packages/shared/clickhouse/migrations/0001_traces.down.sql
rename to packages/shared/clickhouse/migrations/unclustered/0001_traces.down.sql
diff --git a/packages/shared/clickhouse/migrations/0001_traces.up.sql b/packages/shared/clickhouse/migrations/unclustered/0001_traces.up.sql
similarity index 89%
rename from packages/shared/clickhouse/migrations/0001_traces.up.sql
rename to packages/shared/clickhouse/migrations/unclustered/0001_traces.up.sql
index 6d5587581c..6e0d1c5122 100644
--- a/packages/shared/clickhouse/migrations/0001_traces.up.sql
+++ b/packages/shared/clickhouse/migrations/unclustered/0001_traces.up.sql
@@ -22,11 +22,11 @@ CREATE TABLE traces (
INDEX idx_res_metadata_value mapValues(metadata) TYPE bloom_filter(0.01) GRANULARITY 1
) ENGINE = ReplacingMergeTree(event_ts, is_deleted) Partition by toYYYYMM(timestamp)
PRIMARY KEY (
- project_id,
- toDate(timestamp)
+ project_id,
+ toDate(timestamp)
)
ORDER BY (
- project_id,
- toDate(timestamp),
- id
- );
+ project_id,
+ toDate(timestamp),
+ id
+);
diff --git a/packages/shared/clickhouse/migrations/0002_observations.down.sql b/packages/shared/clickhouse/migrations/unclustered/0002_observations.down.sql
similarity index 100%
rename from packages/shared/clickhouse/migrations/0002_observations.down.sql
rename to packages/shared/clickhouse/migrations/unclustered/0002_observations.down.sql
diff --git a/packages/shared/clickhouse/migrations/0002_observations.up.sql b/packages/shared/clickhouse/migrations/unclustered/0002_observations.up.sql
similarity index 91%
rename from packages/shared/clickhouse/migrations/0002_observations.up.sql
rename to packages/shared/clickhouse/migrations/unclustered/0002_observations.up.sql
index 92cf4335c0..cafd0c71eb 100644
--- a/packages/shared/clickhouse/migrations/0002_observations.up.sql
+++ b/packages/shared/clickhouse/migrations/unclustered/0002_observations.up.sql
@@ -34,14 +34,14 @@ CREATE TABLE observations (
INDEX idx_project_id project_id TYPE bloom_filter() GRANULARITY 1
) ENGINE = ReplacingMergeTree(event_ts, is_deleted) Partition by toYYYYMM(start_time)
PRIMARY KEY (
- project_id,
- `type`,
- toDate(start_time)
- )
+ project_id,
+ `type`,
+ toDate(start_time)
+)
ORDER BY (
- project_id,
- `type`,
- toDate(start_time),
- id
- );
+ project_id,
+ `type`,
+ toDate(start_time),
+ id
+);
diff --git a/packages/shared/clickhouse/migrations/0003_scores.down.sql b/packages/shared/clickhouse/migrations/unclustered/0003_scores.down.sql
similarity index 100%
rename from packages/shared/clickhouse/migrations/0003_scores.down.sql
rename to packages/shared/clickhouse/migrations/unclustered/0003_scores.down.sql
diff --git a/packages/shared/clickhouse/migrations/0003_scores.up.sql b/packages/shared/clickhouse/migrations/unclustered/0003_scores.up.sql
similarity index 85%
rename from packages/shared/clickhouse/migrations/0003_scores.up.sql
rename to packages/shared/clickhouse/migrations/unclustered/0003_scores.up.sql
index 15a7e0dd93..e2b4a7bd1c 100644
--- a/packages/shared/clickhouse/migrations/0003_scores.up.sql
+++ b/packages/shared/clickhouse/migrations/unclustered/0003_scores.up.sql
@@ -21,13 +21,13 @@ CREATE TABLE scores (
INDEX idx_project_trace_observation (project_id, trace_id, observation_id) TYPE bloom_filter(0.001) GRANULARITY 1
) ENGINE = ReplacingMergeTree(event_ts, is_deleted) Partition by toYYYYMM(timestamp)
PRIMARY KEY (
- project_id,
- toDate(timestamp),
- name
- )
+ project_id,
+ toDate(timestamp),
+ name
+)
ORDER BY (
- project_id,
- toDate(timestamp),
- name,
- id
- )
+ project_id,
+ toDate(timestamp),
+ name,
+ id
+)
diff --git a/packages/shared/clickhouse/migrations/0004_drop_observations_index.down.sql b/packages/shared/clickhouse/migrations/unclustered/0004_drop_observations_index.down.sql
similarity index 100%
rename from packages/shared/clickhouse/migrations/0004_drop_observations_index.down.sql
rename to packages/shared/clickhouse/migrations/unclustered/0004_drop_observations_index.down.sql
diff --git a/packages/shared/clickhouse/migrations/0004_drop_observations_index.up.sql b/packages/shared/clickhouse/migrations/unclustered/0004_drop_observations_index.up.sql
similarity index 100%
rename from packages/shared/clickhouse/migrations/0004_drop_observations_index.up.sql
rename to packages/shared/clickhouse/migrations/unclustered/0004_drop_observations_index.up.sql
diff --git a/packages/shared/clickhouse/migrations/0005_add_session_id_index.down.sql b/packages/shared/clickhouse/migrations/unclustered/0005_add_session_id_index.down.sql
similarity index 100%
rename from packages/shared/clickhouse/migrations/0005_add_session_id_index.down.sql
rename to packages/shared/clickhouse/migrations/unclustered/0005_add_session_id_index.down.sql
diff --git a/packages/shared/clickhouse/migrations/0005_add_session_id_index.up.sql b/packages/shared/clickhouse/migrations/unclustered/0005_add_session_id_index.up.sql
similarity index 100%
rename from packages/shared/clickhouse/migrations/0005_add_session_id_index.up.sql
rename to packages/shared/clickhouse/migrations/unclustered/0005_add_session_id_index.up.sql
diff --git a/packages/shared/clickhouse/scripts/down.sh b/packages/shared/clickhouse/scripts/down.sh
index 73955f4310..7df218423b 100644
--- a/packages/shared/clickhouse/scripts/down.sh
+++ b/packages/shared/clickhouse/scripts/down.sh
@@ -1,7 +1,13 @@
#!/bin/bash
# Load environment variables
-source ../../.env
+[ -f ../../.env ] && source ../../.env
+
+# Check if CLICKHOUSE_URL is configured
+if [ -z "${CLICKHOUSE_URL}" ]; then
+ echo "Info: CLICKHOUSE_URL not configured, skipping migration."
+ exit 0
+fi
# Check if golang-migrate is installed
if ! command -v migrate &> /dev/null
@@ -13,10 +19,22 @@ then
fi
# Construct the database URL
-if [ "$CLICKHOUSE_MIGRATION_SSL" = true ] ; then
- DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&secure=true&skip_verify=true&x-migrations-table-engine=MergeTree"
+if [ "$CLICKHOUSE_MIGRATION_CLUSTER_DISABLED" != "true" ] ; then
+ if [ "$CLICKHOUSE_MIGRATION_SSL" = true ] ; then
+ DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&secure=true&skip_verify=true&x-cluster-name=default&x-migrations-table-engine=ReplicatedMergeTree"
+ else
+ DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&x-cluster-name=default&x-migrations-table-engine=ReplicatedMergeTree"
+ fi
+
+ # Execute the up command
+ migrate -source file://clickhouse/migrations/clustered -database "$DATABASE_URL" down
else
- DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&x-migrations-table-engine=MergeTree"
-fi
-# Execute the down command
-migrate -source file://clickhouse/migrations -database "$DATABASE_URL" down
+ if [ "$CLICKHOUSE_MIGRATION_SSL" = true ] ; then
+ DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&secure=true&skip_verify=true&x-migrations-table-engine=MergeTree"
+ else
+ DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&x-migrations-table-engine=MergeTree"
+ fi
+
+ # Execute the up command
+ migrate -source file://clickhouse/migrations/unclustered -database "$DATABASE_URL" down
+fi
\ No newline at end of file
diff --git a/packages/shared/clickhouse/scripts/up.sh b/packages/shared/clickhouse/scripts/up.sh
index 1893ca62fe..c5d7d94737 100644
--- a/packages/shared/clickhouse/scripts/up.sh
+++ b/packages/shared/clickhouse/scripts/up.sh
@@ -19,11 +19,22 @@ then
fi
# Construct the database URL
-if [ "$CLICKHOUSE_MIGRATION_SSL" = true ] ; then
- DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&secure=true&skip_verify=true&x-migrations-table-engine=MergeTree"
+if [ "$CLICKHOUSE_MIGRATION_CLUSTER_DISABLED" != "true" ] ; then
+ if [ "$CLICKHOUSE_MIGRATION_SSL" = true ] ; then
+ DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&secure=true&skip_verify=true&x-cluster-name=default&x-migrations-table-engine=ReplicatedMergeTree"
+ else
+ DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&x-cluster-name=default&x-migrations-table-engine=ReplicatedMergeTree"
+ fi
+
+ # Execute the up command
+ migrate -source file://clickhouse/migrations/clustered -database "$DATABASE_URL" up
else
- DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&x-migrations-table-engine=MergeTree"
-fi
+ if [ "$CLICKHOUSE_MIGRATION_SSL" = true ] ; then
+ DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&secure=true&skip_verify=true&x-migrations-table-engine=MergeTree"
+ else
+ DATABASE_URL="${CLICKHOUSE_MIGRATION_URL}?username=${CLICKHOUSE_USER}&password=${CLICKHOUSE_PASSWORD}&database=default&x-multi-statement=true&x-migrations-table-engine=MergeTree"
+ fi
-# Execute the up command
-migrate -source file://clickhouse/migrations -database "$DATABASE_URL" up
+ # Execute the up command
+ migrate -source file://clickhouse/migrations/unclustered -database "$DATABASE_URL" up
+fi
diff --git a/packages/shared/package.json b/packages/shared/package.json
index 90f3d1c686..d114ffbd15 100644
--- a/packages/shared/package.json
+++ b/packages/shared/package.json
@@ -43,7 +43,6 @@
"db:generate": "dotenv -e ../../.env -- npx prisma generate",
"db:seed:examples": "dotenv -e ../../.env -- npx prisma db seed -- --environment examples",
"db:seed:load": "dotenv -e ../../.env -- npx prisma db seed -- --environment load",
- "ch:status": "dotenv -e ../../.env -- goose -dir './clickhouse/migrations/' status",
"ch:up": "bash clickhouse/scripts/up.sh",
"ch:down": "bash clickhouse/scripts/down.sh",
"ch:drop": "bash clickhouse/scripts/drop.sh",
diff --git a/web/entrypoint.sh b/web/entrypoint.sh
index 642df79f73..abb3788643 100644
--- a/web/entrypoint.sh
+++ b/web/entrypoint.sh
@@ -36,8 +36,7 @@ if [ $status -ne 0 ]; then
fi
# Execute the Clickhouse migration, except when disabled.
-# TODO: For now, we use the same flag as for the Postgres migration.
-if [ "$LANGFUSE_AUTO_POSTGRES_MIGRATION_DISABLED" != "true" ]; then
+if [ "$LANGFUSE_AUTO_CLICKHOUSE_MIGRATION_DISABLED" != "true" ]; then
# Apply Clickhouse migrations
cd ./packages/shared
sh ./clickhouse/scripts/up.sh