Skip to content

Commit

Permalink
[9.x] Add support for named in-memory SQLite connections
Browse files Browse the repository at this point in the history
PR: laravel/framework#53635

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Dec 5, 2024
1 parent ff10821 commit 7c6da5e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Concerns/HandlesDatabases.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ protected function usesSqliteInMemoryDatabaseConnection(?string $connection = nu
/** @var array{driver: string, database: string}|null $database */
$database = $config->get("database.connections.{$connection}");

return ! \is_null($database) && $database['driver'] === 'sqlite' && $database['database'] == ':memory:';
if (is_null($database) || $database['driver'] !== 'sqlite') {
return false;
}

return $database['database'] == ':memory:'
|| str_contains($database['database'], '?mode=memory')
|| str_contains($database['database'], '&mode=memory');
}

/**
Expand Down

0 comments on commit 7c6da5e

Please sign in to comment.