Default connection for migrations #54035
Unanswered
aagjalpankaj
asked this question in
Ideas
Replies: 2 comments 2 replies
-
My suggestion would be for you to sub-class the |
Beta Was this translation helpful? Give feedback.
2 replies
-
No harm in having options here—go for it, I'd say 👍🏻 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently Laravel provides two ways to specify database connection for migrations:
php artisan migrate --database=<connection_name>
Schema::connection('connection_name')->
Otherwise it uses the default connection specified in
database.php
.Can we allow specifying default connection just for migrations like below in
database.php
?What prompts us to trigger this requirement?
We create two separate database connections - one for application and another for migration. Only migration user has DDL permissions. We use laravel automations and that does't allow
--database
option while executing migrations. So we always need to specify connection explicitly in the migration usingSchema::connection('connection_name')->
.I understand that this requirement may seem superfluous and not urgent, but good to see what you guys think about it :)
Beta Was this translation helpful? Give feedback.
All reactions