fix: create clickhouse db in tests only

This commit is contained in:
Michael H.
2026-07-30 20:08:49 +02:00
parent 572b8027ff
commit c5ce5bc9b3
2 changed files with 11 additions and 0 deletions
+8
View File
@@ -39,6 +39,14 @@ fn connect() -> clickhouse::error::Result<clickhouse::Client> {
.with_validation(false))
}
#[cfg(feature = "test")]
pub async fn create_database(database: &str) -> clickhouse::error::Result<()> {
connect()?
.query(&format!("CREATE DATABASE IF NOT EXISTS {database}"))
.execute()
.await
}
pub async fn run_migrations() -> clickhouse::error::Result<()> {
run_migrations_on_database(&ENV.CLICKHOUSE_DATABASE).await
}