Fix schema init: bypass DataSource, use direct JDBC with qualified table names
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user