Skip to content

Commit

Permalink
Merge pull request #427 from yoramdelangen/master
Browse files Browse the repository at this point in the history
feat: Added support for migrating single file
  • Loading branch information
owenvoke committed Jan 11, 2021
2 parents 3a67c0b + ac7e987 commit 5f4d31a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Components/Database/Migrator.php
Expand Up @@ -15,6 +15,7 @@

use function collect;
use Illuminate\Database\Migrations\Migrator as BaseMigrator;
use Illuminate\Support\Str;
use SplFileInfo;
use Symfony\Component\Finder\Finder;

Expand All @@ -35,10 +36,16 @@ public function getMigrationFiles($paths): array
return collect($paths)
->flatMap(
function ($path) {
return collect(
(new Finder)->in([$path])
if (Str::endsWith($path, '.php')) {
$finder = (new Finder)->in([dirname($path)])
->files()
)
->name(basename($path));
} else {
$finder = (new Finder)->in([$path])
->files();
}

return collect($finder)
->map(
function (SplFileInfo $file) {
return $file->getPathname();
Expand Down

0 comments on commit 5f4d31a

Please sign in to comment.