1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-04 09:04:03 +00:00

Ensure tenant DB charset is uppercase and database name is validated

This commit is contained in:
sarwar 2026-01-04 10:58:44 +06:00
parent 3b38bc4e4e
commit 3b0c1b0988

View file

@ -11,10 +11,9 @@ class PostgreSQLDatabaseManager extends TenantDatabaseManager
public function createDatabase(TenantWithDatabase $tenant): bool
{
$database = $tenant->database()->getName();
$charset = $this->connection()->getConfig('charset');
$collation = $this->connection()->getConfig('collation');
$charset = strtoupper($this->connection()->getConfig('charset') ?? 'UTF8');
return $this->connection()->statement("CREATE DATABASE \"{$database}\" WITH TEMPLATE=template0 ENCODING='{$charset}' LC_COLLATE='{$collation}' LC_CTYPE='{$collation}'");
return $this->connection()->statement("CREATE DATABASE \"{$database}\" WITH TEMPLATE=template0 ENCODING='{$charset}'");
}
public function deleteDatabase(TenantWithDatabase $tenant): bool