Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Support] Cannot Hide db:wipe command #416

Closed
robertmarney opened this issue Jun 8, 2022 · 11 comments
Closed

[Support] Cannot Hide db:wipe command #416

robertmarney opened this issue Jun 8, 2022 · 11 comments

Comments

@robertmarney
Copy link

Apologies if this has been asked before, I am trying to build a phar for dsitribution that will ship with a migrated db.

I am trying to hide db:wipe from the command list when the application is called, I have added Illuminate\Database\Console\WipeCommand::class to either and then both of the hidden and remove arrays in commands.php with no luck

@chrisbradleydev
Copy link

I ran into the same issue today.

@etyson17
Copy link

etyson17 commented Jul 7, 2022

I am running into the same issue.

@nunomaduro
Copy link
Member

@robertmarney @chrisbradleydev @etyson17 Can one of you work on pull request please?

@chrisbradleydev
Copy link

@nunomaduro would you please point us in the right direction?

Is this functionality in the framework repository?

@chrisbradleydev
Copy link

Or would it be here?

https://github.com/nunomaduro/laravel-console-summary

@etyson17
Copy link

@nunomaduro I have been able to hide the db:wipe command by removing the protected static $defaultName = 'db:wipe'; and #[AsCommand(name: 'db:wipe')].

Is there a test I can run to ensure this is not going to break anything?

https://github.com/illuminate/database/blob/9.x/Console/WipeCommand.php#L10-L31

@chrisbradleydev
Copy link

@nunomaduro

I can confirm this behavior, although I'm not certain this is an acceptable solution.

If I comment lines 7, 10, and 31 in https://github.com/illuminate/database/blob/9.x/Console/WipeCommand.php and add Illuminate\Database\Console\WipeCommand::class to removed commands in my Laravel Zero project, it removes the db:wipe command from the CLI menu.

@etyson17
Copy link

It appears that lines 7 & 10 were added back in April but I am unsure why. Any clarification would be extremely helpful.

Here is where they were added:
laravel/framework#41982

@robertmarney
Copy link
Author

Thanks for the investigation to date, I am going to monitor the discussion at laravel/framework#41982 and see what comes from there.

@nunomaduro - My understanding is that Zero executes an artisan list and then wraps the result, if so then a good path forward might be to handle the exclusion after that function is processed?

@mugennsou
Copy link

Hello @nunomaduro , I just fix this issue and make a pull request, could you have a look? Thank you.

@owenvoke
Copy link
Member

Hi @robertmarney, this should now be resolved in the latest version of the framework. 👍🏻 (At least, using hidden). Let me know if you have any further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants