nWidart / laravel-modules

Module Management In Laravel
https://docs.laravelmodules.com
MIT License
5.5k stars 954 forks source link

Fix for Running Root Migrations Before Module Migrations #1919

Closed alissn closed 1 month ago

alissn commented 1 month ago

Hi,

While testing the module:migrate-fresh command, I discovered that root migrations were not being executed before the module migrations.

This issue occurs because, in the Laravel framework's migrate command, the default migration paths are merged when the method is called, but they are not registered by default. You can see the relevant code here: Laravel Framework Migration Command.

return array_merge(
    $this->migrator->paths(), [$this->getMigrationPath()]
);

This pull request addresses and fixes this issue, ensuring that root migrations are executed before module migrations.