Skip to content

Commit 2298bc3

Browse files
authored
[10.x] Laravel 10x optional withSize for hasTable (#50888)
* make withsize optional for SQLiteBuilder's getTables * refactoring SQLiteBuilder::getTables Signed-off-by: Apos Spanos <[email protected]> * correcting SQLiteBuilder::getTables Signed-off-by: Apos Spanos <[email protected]> --------- Signed-off-by: Apos Spanos <[email protected]>
1 parent a8a40d9 commit 2298bc3

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/Illuminate/Database/Schema/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function hasTable($table)
162162
{
163163
$table = $this->connection->getTablePrefix().$table;
164164

165-
foreach ($this->getTables() as $value) {
165+
foreach ($this->getTables(false) as $value) {
166166
if (strtolower($table) === strtolower($value['name'])) {
167167
return true;
168168
}

src/Illuminate/Database/Schema/SQLiteBuilder.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ public function dropDatabaseIfExists($name)
3434
/**
3535
* Get the tables for the database.
3636
*
37+
* @param bool $withSize
3738
* @return array
3839
*/
39-
public function getTables()
40+
public function getTables($withSize = true)
4041
{
41-
$withSize = false;
42-
43-
try {
44-
$withSize = $this->connection->scalar($this->grammar->compileDbstatExists());
45-
} catch (QueryException $e) {
46-
//
42+
if ($withSize) {
43+
try {
44+
$withSize = $this->connection->scalar($this->grammar->compileDbstatExists());
45+
} catch (QueryException $e) {
46+
$withSize = false;
47+
}
4748
}
4849

4950
return $this->connection->getPostProcessor()->processTables(

0 commit comments

Comments
 (0)