Fix clickhouse migrations by adding the secure=true query param (#2160)

This commit is contained in:
Eric Allam
2025-06-10 13:45:24 +01:00
committed by GitHub
parent e6fb32194e
commit a060ceef0b
+13 -1
View File
@@ -14,7 +14,19 @@ if [ -n "$CLICKHOUSE_URL" ]; then
# Run ClickHouse migrations
echo "Running ClickHouse migrations..."
export GOOSE_DRIVER=clickhouse
export GOOSE_DBSTRING="$CLICKHOUSE_URL" # Use the full URL provided by the env var
# Ensure secure=true is in the connection string
if echo "$CLICKHOUSE_URL" | grep -q "secure="; then
# secure parameter already exists, use as is
export GOOSE_DBSTRING="$CLICKHOUSE_URL"
elif echo "$CLICKHOUSE_URL" | grep -q "?"; then
# URL has query parameters, append secure=true
export GOOSE_DBSTRING="${CLICKHOUSE_URL}&secure=true"
else
# URL has no query parameters, add secure=true
export GOOSE_DBSTRING="${CLICKHOUSE_URL}?secure=true"
fi
export GOOSE_MIGRATION_DIR=/triggerdotdev/internal-packages/clickhouse/schema
/usr/local/bin/goose up
echo "ClickHouse migrations complete."