mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 06:34:04 +00:00
Swap try/catch for if statements
This commit is contained in:
parent
2d75f185b8
commit
eae4d378f7
2 changed files with 6 additions and 9 deletions
|
|
@ -38,10 +38,8 @@ class CreatePostgresUserForTenant implements ShouldQueue
|
|||
$name = $this->tenant->getTenantKey();
|
||||
$password = $this->tenant->database()->getPassword() ?? 'password';
|
||||
|
||||
try {
|
||||
if (count(DB::select("SELECT usename FROM pg_user WHERE usename = '$name';")) > 0) {
|
||||
DB::statement("CREATE USER \"$name\" LOGIN PASSWORD '$password';");
|
||||
} catch (QueryException $exception) {
|
||||
// Skip creating Postgres user if it already exists
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue