Skip to content

Commit 7438b0d

Browse files
author
Paul Rogers
committed
refactor(MigrateDumpCommand::sqliteDump): Simply slightly.
1 parent eeefcec commit 7438b0d

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/Commands/MigrateDumpCommand.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,11 @@ private static function sqliteDump(array $db_config, string $schema_sql_path) :
174174
$tables = preg_split('/\s+/', implode(' ', $output));
175175

176176
foreach ($tables as $table) {
177-
// Migrations to be dumped with data afterward.
178-
if ('migrations' === $table) {
179-
continue;
180-
}
177+
// Only migrations should dump data with schema.
178+
$sql_command = 'migrations' === $table ? '.dump' : '.schema';
181179

182180
passthru(
183-
$command_prefix . ' ' . escapeshellarg(".schema $table")
181+
$command_prefix . ' ' . escapeshellarg("$sql_command $table")
184182
. ' >> ' . escapeshellarg($schema_sql_path),
185183
$exit_code
186184
);
@@ -189,15 +187,6 @@ private static function sqliteDump(array $db_config, string $schema_sql_path) :
189187
}
190188
}
191189

192-
passthru(
193-
$command_prefix . ' ' . escapeshellarg(".dump migrations")
194-
. ' >> ' . escapeshellarg($schema_sql_path),
195-
$exit_code
196-
);
197-
if (0 !== $exit_code) {
198-
return $exit_code;
199-
}
200-
201190
return $exit_code;
202191
}
203192
}

0 commit comments

Comments
 (0)