File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/Illuminate/Database/Console Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,17 @@ public function handle(ConnectionResolverInterface $connections)
4747 array_keys ($ tables )
4848 );
4949
50- $ table = $ tables [$ tableName ] ?? Arr::first ($ tables , fn ($ table ) => $ table ['name ' ] === $ tableName );
50+ $ table = $ tables [$ tableName ] ?? (new Collection ($ tables ))->when (
51+ Arr::wrap ($ connection ->getSchemaBuilder ()->getCurrentSchemaListing ()
52+ ?? $ connection ->getSchemaBuilder ()->getCurrentSchemaName ()),
53+ fn (Collection $ collection , array $ currentSchemas ) => $ collection ->sortBy (
54+ function (array $ table ) use ($ currentSchemas ) {
55+ $ index = array_search ($ table ['schema ' ], $ currentSchemas );
56+
57+ return $ index === false ? PHP_INT_MAX : $ index ;
58+ }
59+ )
60+ )->firstWhere ('name ' , $ tableName );
5161
5262 if (! $ table ) {
5363 $ this ->components ->warn ("Table [ {$ tableName }] doesn't exist. " );
You can’t perform that action at this time.
0 commit comments