mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 08:24:05 +00:00
Add comment
This commit is contained in:
parent
20cb3dc647
commit
39fe252ef6
1 changed files with 1 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ class CreatePostgresUserForTenant implements ShouldQueue
|
|||
$name = $this->tenant->getTenantKey();
|
||||
$password = $this->tenant->database()->getPassword() ?? 'password';
|
||||
|
||||
// Create the user only if it doesn't already exist
|
||||
if (count(DB::select("SELECT usename FROM pg_user WHERE usename = '$name';")) > 0) {
|
||||
DB::statement("CREATE USER \"$name\" LOGIN PASSWORD '$password';");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue