Allow subdirectories in migration file names (#4225)
Credit to @GinoPane. Fixes #4224.
This commit is contained in:
parent
956a234920
commit
2e0d2d3888
|
|
@ -530,7 +530,7 @@ class VersionManager
|
|||
protected function extractScriptsAndComments($details)
|
||||
{
|
||||
if (is_array($details)) {
|
||||
$fileNamePattern = '/^[a-z_\-0-9\.]*\.php$/i';
|
||||
$fileNamePattern = "/^[a-z0-9\_\-\.\/\\\]+\.php$/i";
|
||||
|
||||
$comments = array_values(array_filter($details, function ($detail) use ($fileNamePattern) {
|
||||
return !preg_match($fileNamePattern, $detail);
|
||||
|
|
|
|||
|
|
@ -186,6 +186,22 @@ class VersionManagerTest extends TestCase
|
|||
'file.name.with.dots.php',
|
||||
'1.0.2.scripts_can_go_anywhere.php'
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
'subdirectory/file.name.with.dots.php',
|
||||
'The first update comment',
|
||||
'subdirectory\1.0.2.scripts_can_go_anywhere.php',
|
||||
'The second update comment',
|
||||
],
|
||||
[
|
||||
'The first update comment',
|
||||
'The second update comment'
|
||||
],
|
||||
[
|
||||
'subdirectory/file.name.with.dots.php',
|
||||
'subdirectory\1.0.2.scripts_can_go_anywhere.php'
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue