Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 4, 2020
1 parent 5c1d55a commit c43054b
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/Illuminate/Database/Schema/MySqlSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ protected function appendMigrationData(string $path)
*/
public function load($path)
{
$cmd = 'mysql '.$this->connectionString().' --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"';
$command = 'mysql '.$this->connectionString().' --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"';

$this->makeProcess($cmd)->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [
$this->makeProcess($command)->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [
'LARAVEL_LOAD_PATH' => $path,
]));
}
Expand All @@ -83,13 +83,13 @@ public function load($path)
*/
protected function baseDumpCommand()
{
$cmd = 'mysqldump '.$this->connectionString().' --skip-add-locks --skip-comments --skip-set-charset --tz-utc';
$command = 'mysqldump '.$this->connectionString().' --skip-add-locks --skip-comments --skip-set-charset --tz-utc';

if ($this->connection->isMaria()) {
$cmd .= ' --column-statistics=0 --set-gtid-purged=OFF';
$command .= ' --column-statistics=0 --set-gtid-purged=OFF';
}

return $cmd.' "${:LARAVEL_LOAD_DATABASE}"';
return $command.' "${:LARAVEL_LOAD_DATABASE}"';
}

/**
Expand Down Expand Up @@ -138,20 +138,18 @@ protected function executeDumpProcess(Process $process, $output, array $variable
}

/**
* Generate a common connection string (--socket, --host, --port, --user, --password).
* Generate a basic connection string (--socket, --host, --port, --user, --password) for the database.
*
* @return string
*/
protected function connectionString()
{
$cmd = ' --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}"';
$value = ' --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}"';

if ($this->connection->getConfig()['unix_socket'] ?? false) {
$cmd .= ' --socket="${:LARAVEL_LOAD_SOCKET}"';
} else {
$cmd .= ' --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}"';
}
$value .= $this->connection->getConfig()['unix_socket'] ?? false
? ' --socket="${:LARAVEL_LOAD_SOCKET}"'
: ' --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}"';

return $cmd;
return $value;
}
}

0 comments on commit c43054b

Please sign in to comment.