drfraker/snipe-migrations

Running tests results in "The "" directory does not exist."

NaLogo opened this issue · 2 comments

I installed Snipe-Migrations according to the Readme, but running tests that use RefreshDatabase, the package is unable to create a snapshot and populate the database.
Instead, I get an error telling me that "The "" directory does not exist.".

I did some digging and a possible issue might be that "app()['migrator']->paths()" includes an empty entry at index 0. Not sure if that's normal or where that's coming from. At least that's the point where the script seems to fail.

Hello, I had a similar problem. It was not creating the snapshots, but I think that is not the same problem, but maybe my solution fixes the creation of the snapshots.

If you want, you can check my pull request to check it it works also for you ( #34 )

You can use my branch in your composer.json editing it:

"require" {
        ...
        "drfraker/snipe-migrations": "dev-feature/windows-fixes"
        ...
},
"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/royfandi/snipe-migrations"
        }
],

(More info: https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository)

Hello again. Took me a while to get around to trying this.

Unfortunately, the windows-fixes branch does not seem to include changes that fix this issue for me. It continues throwing the same error message.

I'm running this on a Laravel installation within a Homestead VM.

Edit: It seems like this issue is fixed by making the following change to Snipe.php on line 87:

return collect(array_filter(app()['migrator']->paths())) ->concat([database_path('migrations')]) ->map(function ($path) { return collect(File::allFiles($path)) ->sum(function ($file) { return $file->getMTime(); }); })->sum();

I'm running array_filter on the migration paths to remove empty paths from the result - which previously caused this error, apparently.