Skip to content

Commit

Permalink
#23 - mysqldump command upgraded with smarter DEFINER change
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbiarda committed Jun 30, 2022
1 parent 54d7a3a commit fba0412
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Engines/MySql/Export/Primary.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function assembleEmptyCommand(EnvironmentInterface $environment)
[
"--no-data",
$tables,
"| sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/'",
"| sed -E 's/DEFINER[ ]*=[ ]*`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g'",
">>",
$this->getDumpFile()
]
Expand All @@ -139,7 +139,7 @@ public function assembleCommand(EnvironmentInterface $environment)
[
$this->assembleEmptyTables($environment),
$this->assembleIgnoredTables($environment),
"| sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/'",
"| sed -E 's/DEFINER[ ]*=[ ]*`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g'",
">",
$this->getDumpFile()
]
Expand Down
2 changes: 1 addition & 1 deletion src/Engines/MySql/Sandbox/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private function assembleCommand($environmentName, $ignoredTables)
], $this->getIgnoredTables($ignoredTables)));

$command .= " {$this->connection->getDatabase()} ";
$command .= "| sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' ";
$command .= "| sed -E 's/DEFINER[ ]*=[ ]*`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' ";

if ($this->compressOutput()) {
$command .= ' ' . implode(' ', [
Expand Down

0 comments on commit fba0412

Please sign in to comment.