mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:34:04 +00:00
Add PostgreSQL DB driver (#52)
This commit is contained in:
parent
f2819adcd2
commit
b2e2460c34
5 changed files with 87 additions and 8 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 TEMPLATE=template0");
|
||||
}
|
||||
|
||||
public function deleteDatabase(string $name): bool
|
||||
{
|
||||
return DB::statement("DROP DATABASE $name");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue