Skip to content

Conversation

hafezdivandari
Copy link
Contributor

When running the db:table Artisan command with a non-schema-qualified table name (for example, db:table users), the command currently searches for the table name in an alphabetically sorted list, causing the configured current schemas to be ignored.

This PR updates the command to prioritize the current schema when resolving the table name. This ensures that the db:table command aligns with expected database search order rather than alphabetical schema sorting.

  • PostgreSQL: Search within the schemas listed in the search_path config property first, then fall back to other schemas.
  • MySQL / MariaDB / SQL Server / SQLite: Check the default schema first, then search in other schemas.

Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@hafezdivandari hafezdivandari marked this pull request as ready for review August 13, 2025 17:51
@taylorotwell taylorotwell merged commit d8f38d8 into laravel:12.x Aug 13, 2025
60 checks passed
@hafezdivandari hafezdivandari deleted the 12.x-db-table-schema-search-path branch August 14, 2025 00:57
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.

php artisan db:table command ignores configured database and uses first alphabetical database
2 participants