From 8e4ea2ca1fd8609d118e9cc2a4ff30bf441345aa Mon Sep 17 00:00:00 2001 From: PoroshkinaVV Date: Thu, 29 Feb 2024 12:32:54 +0300 Subject: [PATCH] Don't throw exception when creating database --- lib/active_record/connection_adapters/clickhouse_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_record/connection_adapters/clickhouse_adapter.rb b/lib/active_record/connection_adapters/clickhouse_adapter.rb index d90ded3f..89518467 100644 --- a/lib/active_record/connection_adapters/clickhouse_adapter.rb +++ b/lib/active_record/connection_adapters/clickhouse_adapter.rb @@ -264,7 +264,7 @@ def show_create_table(table) # Create a new ClickHouse database. def create_database(name) - sql = apply_cluster "CREATE DATABASE #{quote_table_name(name)}" + sql = apply_cluster "CREATE DATABASE IF NOT EXISTS #{quote_table_name(name)}" log_with_debug(sql, adapter_name) do res = @connection.post("/?#{@connection_config.except(:database).to_param}", sql) process_response(res)