@@ -430,11 +430,11 @@ private static function sqliteSchemaDump(array $db_config, string $schema_sql_pa
430
430
431
431
/**
432
432
* @param array $db_config
433
- * @param string $schema_sql_path
433
+ * @param string $data_sql_path
434
434
*
435
435
* @return int
436
436
*/
437
- private static function sqliteDataDump (array $ db_config , string $ schema_sql_path ) : int
437
+ private static function sqliteDataDump (array $ db_config , string $ data_sql_path ) : int
438
438
{
439
439
// CONSIDER: Accepting command name as option or from config.
440
440
$ command_prefix = 'sqlite3 ' . escapeshellarg ($ db_config ['database ' ]);
@@ -451,8 +451,13 @@ private static function sqliteDataDump(array $db_config, string $schema_sql_path
451
451
$ tables = preg_split ('/\s+/ ' , implode (' ' , $ output ));
452
452
453
453
foreach ($ tables as $ table ) {
454
+ // We don't want to dump the migrations table here
455
+ if ('migrations ' === $ table ) {
456
+ continue ;
457
+ }
458
+
454
459
// Only migrations should dump data with schema.
455
- $ sql_command = 'migrations ' !== $ table ? ' .dump ' : ' .schema ' ;
460
+ $ sql_command = '.dump ' ;
456
461
457
462
$ output = [];
458
463
exec (
@@ -465,14 +470,8 @@ private static function sqliteDataDump(array $db_config, string $schema_sql_path
465
470
return $ exit_code ;
466
471
}
467
472
468
- if ('migrations ' !== $ table ) {
469
- $ insert_rows = array_slice ($ output , 4 , -1 );
470
- $ sorted = self ::reorderMigrationRows ($ insert_rows );
471
- array_splice ($ output , 4 , -1 , $ sorted );
472
- }
473
-
474
473
file_put_contents (
475
- $ schema_sql_path ,
474
+ $ data_sql_path ,
476
475
implode (PHP_EOL , $ output ) . PHP_EOL ,
477
476
FILE_APPEND
478
477
);
0 commit comments