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

🔌 Use the model connection for the Schema checks #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rabrowne85
Copy link
Contributor

@rabrowne85 rabrowne85 commented Dec 22, 2022

For certain setups, models have a different connection set directly on the model by overloading the getConnectionName(). Examples of this would be spatie/laravel-multitenancy.

When this is the case, the tests will fail as the connection is not the "default".

This PR determines makes use of the model's getConnection() method and sets this on the Schema directly. Then the correct connection is used.

There is a check in the getModelConnection() method to ensure that a model is present and that it is a suitable model class.

I don't think that this is a breaking change as the tests all pass. However, as this uses the model connection now, it could be worth a second set of eyes looking over it to make sure that there aren't any fringe cases that aren't obvious.

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.

1 participant