Skip to content

Commit

Permalink
Fixes table already exists on L10 and L11
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Oct 13, 2023
1 parent f33613c commit 5053dcf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Sushi.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ protected function createTableSafely(string $tableName, Closure $callback)
try {
$schemaBuilder->create($tableName, $callback);
} catch (QueryException $e) {
if (Str::contains($e->getMessage(), 'already exists (SQL: create table')) {
if (Str::contains($e->getMessage(), [
'already exists (SQL: create table',
sprintf('table "%s" already exists', $tableName),
])) {
// This error can happen in rare circumstances due to a race condition.
// Concurrent requests may both see the necessary preconditions for
// the table creation, but only one can actually succeed.
Expand Down

0 comments on commit 5053dcf

Please sign in to comment.