Fix schema init: bypass DataSource, use direct JDBC with qualified table names
All checks were successful
CI / build (push) Successful in 48s
CI / docker (push) Successful in 40s
CI / deploy (push) Successful in 7s

The auto-configured DataSource targets jdbc:ch://.../cameleer3 which fails
if the database doesn't exist yet. Schema init now uses a direct JDBC
connection to the root URL, creates the database first, then applies all
schema SQL with fully qualified cameleer3.* table names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-12 21:50:47 +01:00
parent 48bdb46760
commit ce0eb58b0c
3 changed files with 25 additions and 34 deletions

View File

@@ -1,7 +1,7 @@
-- Cameleer3 ClickHouse Schema
-- Tables for route executions, route diagrams, and agent metrics.
CREATE TABLE IF NOT EXISTS route_executions (
CREATE TABLE IF NOT EXISTS cameleer3.route_executions (
execution_id String,
route_id LowCardinality(String),
agent_id LowCardinality(String),
@@ -32,7 +32,7 @@ ORDER BY (agent_id, status, start_time, execution_id)
TTL toDateTime(start_time) + toIntervalDay(30)
SETTINGS ttl_only_drop_parts = 1;
CREATE TABLE IF NOT EXISTS route_diagrams (
CREATE TABLE IF NOT EXISTS cameleer3.route_diagrams (
content_hash String,
route_id LowCardinality(String),
agent_id LowCardinality(String),
@@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS route_diagrams (
ENGINE = ReplacingMergeTree(created_at)
ORDER BY (content_hash);
CREATE TABLE IF NOT EXISTS agent_metrics (
CREATE TABLE IF NOT EXISTS cameleer3.agent_metrics (
agent_id LowCardinality(String),
collected_at DateTime64(3, 'UTC'),
metric_name LowCardinality(String),