diff --git a/src/Commands/MigrateDumpCommand.php b/src/Commands/MigrateDumpCommand.php index d933ce4..68601f0 100644 --- a/src/Commands/MigrateDumpCommand.php +++ b/src/Commands/MigrateDumpCommand.php @@ -84,6 +84,10 @@ private static function mysqlDump(array $db_config, string $schema_sql_path) : i . ' --no-data', $exit_code ); + if (0 !== $exit_code) { + return $exit_code; + } + $schema_sql = file_get_contents($schema_sql_path); if (false === $schema_sql) { return 1; @@ -94,15 +98,13 @@ private static function mysqlDump(array $db_config, string $schema_sql_path) : i } // Include migration rows to avoid unnecessary reruns conflicting. - if (0 === $exit_code) { - // CONSIDER: How this could be done as consistent snapshot with - // dump of structure, and avoid duplicate "SET" comments. - passthru( - $command_prefix . ' migrations --no-create-info --skip-extended-insert >> ' - . escapeshellarg($schema_sql_path), - $exit_code - ); - } + // CONSIDER: How this could be done as consistent snapshot with + // dump of structure, and avoid duplicate "SET" comments. + passthru( + $command_prefix . ' migrations --no-create-info --skip-extended-insert >> ' + . escapeshellarg($schema_sql_path), + $exit_code + ); return $exit_code; } @@ -131,17 +133,18 @@ private static function pgsqlDump(array $db_config, string $schema_sql_path) : i . ' --schema-only', $exit_code ); + if (0 !== $exit_code) { + return $exit_code; + } // Include migration rows to avoid unnecessary reruns conflicting. - if (0 === $exit_code) { - // CONSIDER: How this could be done as consistent snapshot with - // dump of structure, and avoid duplicate "SET" comments. - passthru( - $command_prefix . ' --table=migrations --data-only --inserts >> ' - . escapeshellarg($schema_sql_path), - $exit_code - ); - } + // CONSIDER: How this could be done as consistent snapshot with + // dump of structure, and avoid duplicate "SET" comments. + passthru( + $command_prefix . ' --table=migrations --data-only --inserts >> ' + . escapeshellarg($schema_sql_path), + $exit_code + ); return $exit_code; }