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

feat: Add charset and collation support to PostgreSQLDatabaseManager

This commit is contained in:
sarwar 2026-01-04 10:41:53 +06:00
parent e3701f1cc1
commit 3b38bc4e4e

View file

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