-
Notifications
You must be signed in to change notification settings - Fork 11.6k
[5.5] Autowire migrations #21999
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
[5.5] Autowire migrations #21999
Conversation
is there any immediate benefit from this? or is it more for consistency? |
use Illuminate\Support\Arr; | ||
use Illuminate\Support\Str; | ||
use Illuminate\Support\Collection; | ||
use Illuminate\Container\Container; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should use the contact here instead.
We've had migrations that weren't resolved from the container for several years now, why do we need it now? When do you need to resolve services to modify your database schema? |
I know it's almost irrelevant, but this brings a performance impact as the Reflector will be used to instantiated migration classes. The reason I bring this up is that if there is no upside at all for this, we can see a tiny downside. Also, tests are failing. |
For consistency yes, and because we use MondoDB as our primary data storage and for some reasons we need services from the container. I think the performance impact is so tiny it shouldn't be a problem. I'm going to fix the tests. |
Let's talk about breaking changes. What are we talking about here? In which scenarios will things blow up? Can third party packages be compatible with the current Migrator class and these new changes at the same time? |
I agree. Talk about performance is pointless if there is a visible improvement. I only brought it up because we cannot see the improvement here. It would be nice to know how you're setting up MongoDB with migrations and how this solve that. @sisve I don't think there's any breaking changes here. If we assume that nobody is binding the migration classes into the container, this will auto-wire the class regularly. |
Actually our own use case is related to MongoDB services, but I can imagine it's far from being the only one. I just don't see what's the benefit of NOT having these class autowired ? BC layer should not be a problem as the class were constructed without any arguments (ie. an exception would be thrown). Except for default parameters I guess, but the container is taking care of them. |
@taylorotwell @GrahamCampbell Can you explain why it has been closed ? |
all we currently see in this PR is change for change's sake. can you explain your use case, and what the benefit of this would actually be? |
We are using an internal tool do deal with MongoDB, that needs to be autowired.
|
This PR makes use of the container to autowire the migrations instances.