Skip to content

Commit

Permalink
refactor(MigrateDumpCommand::sqliteDump): Simply slightly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Rogers committed Apr 5, 2019
1 parent eeefcec commit 7438b0d
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/Commands/MigrateDumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,11 @@ private static function sqliteDump(array $db_config, string $schema_sql_path) :
$tables = preg_split('/\s+/', implode(' ', $output));

foreach ($tables as $table) {
// Migrations to be dumped with data afterward.
if ('migrations' === $table) {
continue;
}
// Only migrations should dump data with schema.
$sql_command = 'migrations' === $table ? '.dump' : '.schema';

passthru(
$command_prefix . ' ' . escapeshellarg(".schema $table")
$command_prefix . ' ' . escapeshellarg("$sql_command $table")
. ' >> ' . escapeshellarg($schema_sql_path),
$exit_code
);
Expand All @@ -189,15 +187,6 @@ private static function sqliteDump(array $db_config, string $schema_sql_path) :
}
}

passthru(
$command_prefix . ' ' . escapeshellarg(".dump migrations")
. ' >> ' . escapeshellarg($schema_sql_path),
$exit_code
);
if (0 !== $exit_code) {
return $exit_code;
}

return $exit_code;
}
}

0 comments on commit 7438b0d

Please sign in to comment.