Skip to content

Commit

Permalink
Use native MariaDB CLI commands
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed May 19, 2024
1 parent fa02b4f commit 3b1594d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Console/DbCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function getCommand(array $connection)
{
return [
'mysql' => 'mysql',
'mariadb' => 'mysql',
'mariadb' => 'mariadb',
'pgsql' => 'psql',
'sqlite' => 'sqlite3',
'sqlsrv' => 'sqlcmd',
Expand Down
19 changes: 18 additions & 1 deletion src/Illuminate/Database/Schema/MariaDbSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,31 @@

class MariaDbSchemaState extends MySqlSchemaState
{
/**
* Load the given schema file into the database.
*
* @param string $path
* @return void
*/
public function load($path)
{
$command = 'mariadb '.$this->connectionString().' --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"';

$process = $this->makeProcess($command)->setTimeout(null);

$process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [
'LARAVEL_LOAD_PATH' => $path,
]));
}

/**
* Get the base dump command arguments for MariaDB as a string.
*
* @return string
*/
protected function baseDumpCommand()
{
$command = 'mysqldump '.$this->connectionString().' --no-tablespaces --skip-add-locks --skip-comments --skip-set-charset --tz-utc --column-statistics=0';
$command = 'mariadb-dump '.$this->connectionString().' --no-tablespaces --skip-add-locks --skip-comments --skip-set-charset --tz-utc';

return $command.' "${:LARAVEL_LOAD_DATABASE}"';
}
Expand Down

0 comments on commit 3b1594d

Please sign in to comment.