@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function index(): array |
| 21 | 21 | { |
| 22 | 22 | logs()->debug('Iniciando busca por databases'); |
| 23 | - $result = Process::pipe(function (Pipe $pipe) { |
|
| 23 | + $result = Process::pipe(function(Pipe $pipe) { |
|
| 24 | 24 | $pipe->command("/usr/bin/psql -h {$this->pgHost} -U {$this->pgUser} -l"); |
| 25 | 25 | $pipe->command("awk '{print $1}'"); |
| 26 | 26 | $pipe->command("egrep -v 'List|Name|--|\||\(|dev|hml|__|_2'"); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $total = preg_split('/\n/', $result->output()); |
| 30 | 30 | $total = array_filter($total); |
| 31 | 31 | |
| 32 | - logs()->debug('Total de databases encontrados em prod: ' . count($total)); |
|
| 32 | + logs()->debug('Total de databases encontrados em prod: '.count($total)); |
|
| 33 | 33 | |
| 34 | 34 | return $total; |
| 35 | 35 | } |
@@ -52,17 +52,17 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | Log::debug("Procurando se banco {$database}_dev já existe..."); |
| 54 | 54 | |
| 55 | - $process = Process::pipe(function (Pipe $pipe) use ($database) { |
|
| 55 | + $process = Process::pipe(function(Pipe $pipe) use ($database) { |
|
| 56 | 56 | $pipe->command("/usr/bin/psql -h {$this->pgHost} -U {$this->pgUser} -l"); |
| 57 | 57 | $pipe->command("grep {$database}_dev"); |
| 58 | 58 | }); |
| 59 | 59 | |
| 60 | 60 | if ($process->successful()) { |
| 61 | - logs()->debug('Database encontrado, removendo!: ' . $process->output()); |
|
| 61 | + logs()->debug('Database encontrado, removendo!: '.$process->output()); |
|
| 62 | 62 | Process::run("/usr/bin/psql -h {$this->pgHost} -U {$this->pgUser} -c \"DROP DATABASE {$database}_dev with (force)\""); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - logs()->debug('Criando Database: ' . $process->output()); |
|
| 65 | + logs()->debug('Criando Database: '.$process->output()); |
|
| 66 | 66 | $result = Process::run("/usr/bin/psql -h {$this->pgHost} -U {$this->pgUser} -c \"CREATE DATABASE {$database}_dev\""); |
| 67 | 67 | return $result->successful(); |
| 68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | private function sync(string $database): void |
| 73 | 73 | { |
| 74 | - $process = Process::pipe(function (Pipe $pipe) use ($database) { |
|
| 74 | + $process = Process::pipe(function(Pipe $pipe) use ($database) { |
|
| 75 | 75 | $pipe->command("/usr/bin/pg_dump -h {$this->pgHost} -U {$this->pgUser} -v {$database}"); |
| 76 | 76 | $pipe->command("/usr/bin/psql -h {$this->pgHost} -U {$this->pgUser} {$database}_dev"); |
| 77 | 77 | }); |