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

[11.x] Display migrate and db commands in their namespace #51941

Closed
wants to merge 1 commit into from

Conversation

seriquynh
Copy link
Contributor

@seriquynh seriquynh commented Jun 28, 2024

What is the problem?

Laravel artisan is based on Symfony console component, in which commands without ":" (colons) belong to global namespace. Thus, when listing commands in console, migrate is displayed in global namespace and other migrate:* commands are displayed in migrate namespace. There are 2 cases:

  • When running php artisan, we'll see migrate on the top of the list but must scroll down to see other migrate:* commands.
  • When running php artisan list migrate, we'll see only migrate:* commands and can not see migrate.

I mean same categorized commands (interacting with same things) like migrate commands may be displayed in different namespaces. It's a bit unconvenient, isn't it?

Click to see the current display

Screenshot_11

Solution

I think it's reasonable to display migrate command in "migrate" namespace. Of course, we can use use something like "grep" on Unix-like system but there are still tricks to do it natively.

In this PR, I rename migrate command to migrate:run and set an alias for it. Then, all migrate:* commands are now displayed together. And as you can see, migrate:run is still informative (Run the database migrations). Finally, it's total backward compatibility because "php artisan migrate" still works as it does. I do the exact same thing for db command.

Quick overview

php artisan migrate:run
php artisan migrate

php artisan db:connect
php artisan db

Screenshot_9
Screenshot_10

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

@seriquynh seriquynh deleted the pretty-artisan branch July 5, 2024 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants