mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 20:54:03 +00:00
Use DB transactions
This commit is contained in:
parent
ea9690f915
commit
47fe86c21e
2 changed files with 29 additions and 29 deletions
|
|
@ -39,9 +39,7 @@ class CreatePostgresUserForTenant implements ShouldQueue
|
|||
|
||||
// Create the user only if it doesn't already exist
|
||||
if (! count(DB::select("SELECT usename FROM pg_user WHERE usename = '$name';")) > 0) {
|
||||
DB::transaction(function () use ($name, $password) {
|
||||
DB::statement("CREATE USER \"$name\" LOGIN PASSWORD '$password';");
|
||||
});
|
||||
DB::transaction(fn () => DB::statement("CREATE USER \"$name\" LOGIN PASSWORD '$password';"));
|
||||
}
|
||||
|
||||
$this->grantPermissions((string) $name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue