Skip to content

Commit f22eaf2

Browse files
authored
Use native MariaDB CLI commands (#51505)
1 parent fa02b4f commit f22eaf2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/Illuminate/Database/Console/DbCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function getCommand(array $connection)
133133
{
134134
return [
135135
'mysql' => 'mysql',
136-
'mariadb' => 'mysql',
136+
'mariadb' => 'mariadb',
137137
'pgsql' => 'psql',
138138
'sqlite' => 'sqlite3',
139139
'sqlsrv' => 'sqlcmd',

src/Illuminate/Database/Schema/MariaDbSchemaState.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,31 @@
44

55
class MariaDbSchemaState extends MySqlSchemaState
66
{
7+
/**
8+
* Load the given schema file into the database.
9+
*
10+
* @param string $path
11+
* @return void
12+
*/
13+
public function load($path)
14+
{
15+
$command = 'mariadb '.$this->connectionString().' --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"';
16+
17+
$process = $this->makeProcess($command)->setTimeout(null);
18+
19+
$process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [
20+
'LARAVEL_LOAD_PATH' => $path,
21+
]));
22+
}
23+
724
/**
825
* Get the base dump command arguments for MariaDB as a string.
926
*
1027
* @return string
1128
*/
1229
protected function baseDumpCommand()
1330
{
14-
$command = 'mysqldump '.$this->connectionString().' --no-tablespaces --skip-add-locks --skip-comments --skip-set-charset --tz-utc --column-statistics=0';
31+
$command = 'mariadb-dump '.$this->connectionString().' --no-tablespaces --skip-add-locks --skip-comments --skip-set-charset --tz-utc';
1532

1633
return $command.' "${:LARAVEL_LOAD_DATABASE}"';
1734
}

0 commit comments

Comments
 (0)