Replies: 1 comment 1 reply
-
I agree strongly with this - that the default database connection should be used everywhere by default. Hard coding "mysql" as a default is database-ist and discriminatory against Postgres etc. We need to be equal handed with all databases and not play favourites like this. I might even go so far as to state that using "mysql" rather than the default connection is a bug rather than a feature. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
In most projects, I use several database connections in the framework, and the first thing I do after setting up a new project is to change the names of these connections, and also rename DB_CONNECTION to DB_DEFAULT_CONNECTION. This means that I have to go through each configuration file and make changes. This leads to strange situations in several places, best seen in the
config/queue.php
file. The connection for thejobs
table implicitly uses the default connection, but thefailed_jobs
configuration itself will give the connection namemysql
. The same will be with the recently addedbatching
key. A similar situation occurs, for example, in the configuration for telescope.Wouldn't it be better to use, in all files, the default connection (
config('database.default')
) obtained from the database.php file instead of hardcoded string? I think that 99% of custom cases create migrations on the default connection anyway. And it would greatly clean up the minimalist configuration files in the upcoming Laravel 11.config/database.php
'default' => env('DB_CONNECTION', 'mysql'),
config/queue.php
config/telescope.php
etc.
Beta Was this translation helpful? Give feedback.
All reactions