From 3acfec388eeec2bd5d0b2ea5a684911c1beadc11 Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Wed, 13 Aug 2025 20:46:38 +0330 Subject: [PATCH 1/2] make db:table respect schemas search path --- src/Illuminate/Database/Console/TableCommand.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Console/TableCommand.php b/src/Illuminate/Database/Console/TableCommand.php index fde40a78f8a3..94b313f57849 100644 --- a/src/Illuminate/Database/Console/TableCommand.php +++ b/src/Illuminate/Database/Console/TableCommand.php @@ -47,7 +47,17 @@ public function handle(ConnectionResolverInterface $connections) array_keys($tables) ); - $table = $tables[$tableName] ?? Arr::first($tables, fn ($table) => $table['name'] === $tableName); + $table = $tables[$tableName] ?? (new Collection($tables))->when( + Arr::wrap($connection->getSchemaBuilder()->getCurrentSchemaListing() + ?? $connection->getSchemaBuilder()->getCurrentSchemaName()), + fn (Collection $collection, array $currentSchemas) => $collection->sortBy( + function (array $table) use ($currentSchemas) { + $index = array_search($table['schema'], $currentSchemas); + + return $index === false ? PHP_INT_MAX : $index; + } + ) + )->firstWhere('name', $tableName); if (! $table) { $this->components->warn("Table [{$tableName}] doesn't exist."); From 96b9c046e7f2a475240fbeef7e8c3ef16012ccb8 Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Wed, 13 Aug 2025 21:13:10 +0330 Subject: [PATCH 2/2] force re-run tests