1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 17:04:04 +00:00

query -> statement, remove unnecessary strtoupper()

This commit is contained in:
Samuel Stancl 2026-05-01 16:21:49 +02:00
parent 6b0ff48a86
commit e400b28daa
No known key found for this signature in database
GPG key ID: BA146259A1E16C57

View file

@ -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