nWidart / laravel-modules

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

Migration: Nothing to migrate #1881

Closed osama-98 closed 2 months ago

osama-98 commented 3 months ago

After the last release the migration is not working as expected, instead it goes through all the modules without finding the migrations and prints "noting to migrate" on each module

this is the update that causes the issue.

osama-98 commented 3 months ago

@dcblogdev

alissn commented 3 months ago

Hi, @osama-98

Please follow the steps below to identify the issue and share your results:

  1. Modify the file located at vendor/nwidart/laravel-modules/src/Commands/Database/MigrateCommand.php on line 38:
         $this->migrator = app('migrator');
-        $this->migration_list = collect($this->migrator->paths());
+        $this->migration_list = collect($this->migrator->paths())->dd();
     }
  1. Run the command php artisan migrate or php artisan migrate:fresh.

The result should not be empty and should include the migration paths of each module.

If it is empty, check your module provider. It should include this line to register migrations:

        $this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));

Let me know if this resolves your issue.

JohnnyMaynne commented 3 months ago

After the update v11.0.10 => v11.0.11 , migrations stopped working and show the message "Nothing to migrate". Now you need to create a service provider in each module and register migrations in it, although previously everything worked without this. Now we have to do a lot of work just to run migrations.

trants commented 2 months ago

Same issues!