Skip to content

Commit 497db85

Browse files
author
Paul Rogers
committed
fix(MigrateDumpCommand): Use only timestamp when sorting migration rows since version string could include problematic characters.
1 parent e14e194 commit 497db85

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Commands/MigrateDumpCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ private static function reorderMigrationRows(array $output) : array
6363
$new_id = 1;
6464
foreach ($output as $line) {
6565
$occurrences = preg_match(
66-
'/^(.*?VALUES\s*)\([0-9]+,(.*?),\s*[0-9]+\s*\)\s*;\s*$/iu',
66+
"/^(.*?VALUES\s*)\([0-9]+,'([0-9_]{17})(.*?),\s*[0-9]+\s*\)\s*;\s*$/iu",
6767
$line,
6868
$m
6969
);
7070
if (1 !== $occurrences) {
71-
throw new \UnexpectedValueException('Only insert rows supported');
71+
throw new \UnexpectedValueException(
72+
'Only insert rows supported:' . PHP_EOL . var_export($line, 1)
73+
);
7274
}
73-
$reordered[$m[2]] = "$m[1]($new_id,$m[2],0);";
75+
$reordered[$m[2]] = "$m[1]($new_id,'$m[2]$m[3],0);";
7476
$new_id += 1;
7577
}
7678
return $reordered;

0 commit comments

Comments
 (0)