Skip to content

Commit

Permalink
[9.x] Adds error output to db command when missing host (#44394)
Browse files Browse the repository at this point in the history
* Check for host

* Formatting
  • Loading branch information
joedixon authored Sep 30, 2022
1 parent 13665b7 commit c346a63
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Illuminate/Database/Console/DbCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public function handle()
{
$connection = $this->getConnection();

if (! isset($connection['host'])) {
$this->components->error('No host specified for this database connection.');
$this->line(' Use the <options=bold>[--read]</> and <options=bold>[--write]</> options to specify a read or write connection.');
$this->newLine();

return Command::FAILURE;
}

(new Process(
array_merge([$this->getCommand($connection)], $this->commandArguments($connection)),
null,
Expand Down

0 comments on commit c346a63

Please sign in to comment.