From ddf83c4b556dc4e0f1742979d418f7ac3ebafd5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 1 Sep 2025 21:09:47 +0200 Subject: [PATCH] Assert createDatabase() success Pretty much all errors that can happen in createDatabase() end up throwing an exception, however the function still does return a boolean (it bubbles up the value from the underlying $conn->statement() call) which should be checked in at least some way. --- src/Jobs/CreateDatabase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Jobs/CreateDatabase.php b/src/Jobs/CreateDatabase.php index 94132b7e..6cd035dc 100644 --- a/src/Jobs/CreateDatabase.php +++ b/src/Jobs/CreateDatabase.php @@ -40,7 +40,7 @@ class CreateDatabase implements ShouldQueue try { $databaseManager->ensureTenantCanBeCreated($this->tenant); - $this->tenant->database()->manager()->createDatabase($this->tenant); + assert($this->tenant->database()->manager()->createDatabase($this->tenant) === true); event(new DatabaseCreated($this->tenant)); } catch (TenantDatabaseAlreadyExistsException | TenantDatabaseUserAlreadyExistsException $e) {