-
-
Notifications
You must be signed in to change notification settings - Fork 718
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 default config instead of env as connection #615
Comments
Even though tests are green, I see that |
@micc83 Good catch and thanks for doing it! :) @stancl could you help how the migration should be handled? https://tenancy.samuelstancl.me/docs/v2/tenant-migrations/ And something I've noted after taking a look in the code - we could omit the fallback at all. If our package config is |
@Gummibeer I'll reply above point by point:
So the user will have to manually copy the
I see that both I'll update my fork in a minute. |
The last point was what I meant. So yes, go for it. And the second seems right to me after reading the docs for 5min. |
@Gummibeer great, check the commit on my fork. If it's ok, while waiting for @stancl feedback I'll open a PR. |
This is what a lot of Laravel components/packages do. The published config has no connection key, so it's implicitly null, but it can be set to a specific value.
Yes. All my package needs is a fallback to 'default'. With regards to migrations, they use the database.default connection. They need to be in a special folder just to distinguish them as tenant migrations. @drbyte Pointed out that he'd want to use the activity log both in the central and the tenant parts of his application. The fallback to default makes that possible. This use case also requires that the migration is included in both folders. |
@stancl fair enough, so we should be good to go. I'm opening the PR. |
Fix #615 - Use default config instead of env as connection
This issue relates to archtechx/tenancy#164
The idea is to drop the double
env()
call in package config and use package env ornull
as default value. In model construct we use thedatabase.default
as fallback value.PS: I would prefer null coalescing operator over function nesting.
The text was updated successfully, but these errors were encountered: