mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 13:34:04 +00:00
Add PostgreSQL DB driver
This commit is contained in:
parent
3abde1a791
commit
7a98f0874b
4 changed files with 62 additions and 0 deletions
19
src/TenantDatabaseManagers/PostgreSQLDatabaseManager.php
Normal file
19
src/TenantDatabaseManagers/PostgreSQLDatabaseManager.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\TenantDatabaseManagers;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Stancl\Tenancy\Interfaces\TenantDatabaseManager;
|
||||
|
||||
class PostgreSQLDatabaseManager implements TenantDatabaseManager
|
||||
{
|
||||
public function createDatabase(string $name): bool
|
||||
{
|
||||
return DB::statement("CREATE DATABASE `$name` WITH ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'");
|
||||
}
|
||||
|
||||
public function deleteDatabase(string $name): bool
|
||||
{
|
||||
return DB::statement("DROP DATABASE `$name`");
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ return [
|
|||
'database_managers' => [
|
||||
'sqlite' => 'Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager',
|
||||
'mysql' => 'Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager',
|
||||
'pgsql' => 'Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager',
|
||||
],
|
||||
'queue_database_creation' => false,
|
||||
'queue_database_deletion' => false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue