From 33a27bd5749004960a788ac0b3618d7c2095d2b1 Mon Sep 17 00:00:00 2001 From: "aliaksei.sanikovich" Date: Wed, 17 Aug 2022 13:57:50 +0200 Subject: [PATCH] create database support --- README.md | 5 +++++ src/ClickHousePlatform.php | 2 +- src/Driver.php | 4 ---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6304a45..cb0e482 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,11 @@ $conn = $this->get('doctrine.dbal.clickhouse_connection'); ## Usage +### Create database +```php +php bin/console doctrine:database:create --connection=clickhouse --if-not-exists +``` + ### Create new table ```php // ***quick start*** diff --git a/src/ClickHousePlatform.php b/src/ClickHousePlatform.php index 6dae699..ce3d020 100644 --- a/src/ClickHousePlatform.php +++ b/src/ClickHousePlatform.php @@ -1085,7 +1085,7 @@ public function getDropViewSQL($name) : string */ public function getCreateDatabaseSQL($database) : string { - return 'CREATE DATABASE ' . $this->quoteIdentifier($database); + return 'CREATE DATABASE ' . $database; } /** diff --git a/src/Driver.php b/src/Driver.php index 9f80080..46218d7 100644 --- a/src/Driver.php +++ b/src/Driver.php @@ -50,10 +50,6 @@ public function connect(array $params, $username = null, $password = null, array throw new ClickHouseException('Connection parameter `port` is required'); } - if (! isset($params['dbname'])) { - throw new ClickHouseException('Connection parameter `dbname` is required'); - } - return new ClickHouseConnection($params, (string) $username, (string) $password, $this->getDatabasePlatform()); }