Skip to content

Commit

Permalink
[9.x] db:table command properly handle table who doesn't exist (#43669
Browse files Browse the repository at this point in the history
)

* Added validation doesnt_end_with rule

* db:table command properly handle table who doesn't exist.

* fix style

* Update src/Illuminate/Database/Console/TableCommand.php

Co-authored-by: James Brooks <[email protected]>

* remove unused return statement

Co-authored-by: James Brooks <[email protected]>
  • Loading branch information
kichetof and jbrooksuk authored Aug 15, 2022
1 parent 8235940 commit bbb9493
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Database/Console/TableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public function handle(ConnectionResolverInterface $connections)
collect($schema->listTables())->flatMap(fn (Table $table) => [$table->getName()])->toArray()
);

if (! $schema->tablesExist([$table])) {
return $this->components->warn("Table [{$table}] doesn't exist.");
}

$table = $schema->listTableDetails($table);

$columns = $this->columns($table);
Expand Down

0 comments on commit bbb9493

Please sign in to comment.