From 39fe252ef6b024701ee9ecf83e14eaaf044eb8b5 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Mon, 24 Apr 2023 13:21:05 +0200 Subject: [PATCH] Add comment --- src/Jobs/CreatePostgresUserForTenant.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Jobs/CreatePostgresUserForTenant.php b/src/Jobs/CreatePostgresUserForTenant.php index ea52b274..80ad9e52 100644 --- a/src/Jobs/CreatePostgresUserForTenant.php +++ b/src/Jobs/CreatePostgresUserForTenant.php @@ -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';"); }