mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 18:04:03 +00:00
query -> statement, remove unnecessary strtoupper()
This commit is contained in:
parent
6b0ff48a86
commit
e400b28daa
1 changed files with 4 additions and 3 deletions
|
|
@ -11,16 +11,17 @@ class PostgreSQLDatabaseManager extends TenantDatabaseManager
|
||||||
public function createDatabase(TenantWithDatabase $tenant): bool
|
public function createDatabase(TenantWithDatabase $tenant): bool
|
||||||
{
|
{
|
||||||
$database = $tenant->database()->getName();
|
$database = $tenant->database()->getName();
|
||||||
|
|
||||||
// If null, Postgres creates the DB with the server's default charset
|
// If null, Postgres creates the DB with the server's default charset
|
||||||
$charset = $this->connection()->getConfig('charset');
|
$charset = $this->connection()->getConfig('charset');
|
||||||
|
|
||||||
$query = "CREATE DATABASE \"{$database}\" WITH TEMPLATE=template0";
|
$statement = "CREATE DATABASE \"{$database}\" WITH TEMPLATE=template0";
|
||||||
|
|
||||||
if ($charset !== null) {
|
if ($charset !== null) {
|
||||||
$query .= " ENCODING='" . strtoupper($charset) . "'";
|
$statement .= " ENCODING='{$charset}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->connection()->statement($query);
|
return $this->connection()->statement($statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteDatabase(TenantWithDatabase $tenant): bool
|
public function deleteDatabase(TenantWithDatabase $tenant): bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue