From 59f6685e2aa9abab55f44565e00056ea5771aea5 Mon Sep 17 00:00:00 2001 From: Guy Marriott Date: Thu, 8 Nov 2018 12:05:36 +1300 Subject: [PATCH] FIX Catching situation where database has no tables but it exists --- src/Middleware/InitStateMiddleware.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Middleware/InitStateMiddleware.php b/src/Middleware/InitStateMiddleware.php index f87369a..d173754 100644 --- a/src/Middleware/InitStateMiddleware.php +++ b/src/Middleware/InitStateMiddleware.php @@ -44,8 +44,10 @@ class InitStateMiddleware implements HTTPMiddleware return $delegate($request); } catch (DatabaseException $ex) { $message = $ex->getMessage(); - if (strpos($message, 'No database selected') !== false) { - // Database is not ready, ignore and continue + if (strpos($message, 'No database selected') !== false + || preg_match('/\s*(table|relation) .* does(n\'t| not) exist/i', $message) + ) { + // Database is not ready, ignore and continue. Either it doesn't exist or it has no tables return $delegate($request); } throw $ex;