laravel-modules
laravel-modules copied to clipboard
delete command `module:migrate-fresh`
Hi,
The migrate:fresh command in Laravel fully supports this functionality. This command executes migrate:fresh, followed by module:migrate (not need).
$this->call('migrate:fresh');
$this->call('module:migrate', [
'module' => $this->getModuleName(),
'--database' => $this->option('database'),
'--force' => $this->option('force'),
'--seed' => $this->option('seed'),
]);
sorry, I'm not sure I understand?
@dcblogdev
The command module:migrate-fresh first executes migrate:fresh, which entails dropping all tables and then migrating all migrations from the root project and all module migrations.
Following that, it runs module:migrate with the argument module. The result is:
INFO Nothing to migrate.
On the other hand, all arguments that exist in migrate:fresh are also present in module:migrate.
okay yes, that makes sense now. I'll merge it as part of the v11 release cycle.
@solomon-ochepa
Hi!
The command module:migrate-refresh does exactly what you want.
First, it runs module:migrate-reset, then it calls module:migrate, and finally, it executes module:seed for specific modules.
@dcblogdev Did you take a look at this file? This command exists in the package.
You can find it here: https://github.com/nWidart/laravel-modules/blob/master/src/Commands/MigrateRefreshCommand.php
@dcblogdev Did you take a look at this file? This command exists in the package.
You can find it here: https://github.com/nWidart/laravel-modules/blob/master/src/Commands/MigrateRefreshCommand.php
That is the same file you were asking to be removed.
I believe we can close this PR now and maintain the updated file.
That is the same file you were asking to be removed.
this PR delete src/Commands/MigrateFreshCommand.php file.
it's different with src/Commands/MigrateRefreshCommand.php
That is the same file you were asking to be removed.
this PR delete
src/Commands/MigrateFreshCommand.phpfile. it's different withsrc/Commands/MigrateRefreshCommand.php
Both commands should be maintained. There is a reason why even the Laravel framework maintains both commands.
Nevertheless, the module:migrate-fresh command should run within the scope of the targeted module only; otherwise it should be updated. And if there is no means, we can proceed with deleting it.
The project aims to replicate the core Laravel structure, commands and workflow in a modular architecture.
I think for the sake of compatibility, we could update MigrateFreshCommand to call refresh ie
$this->call('module:migrate-refresh', [
'module' => $this->getModuleName(),
'--database' => $this->option('database'),
'--force' => $this->option('force'),
'--seed' => $this->option('seed'),
]);
Closed, going to restrict module:migrate-fresh to reset only selected modules this way its only in the scope of the module and not the whole application.