-
-
Notifications
You must be signed in to change notification settings - Fork 714
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
Add database connection #568
Conversation
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.
Thank @Gummibeer and Spatie to mantain this usefull package. I'm glad to contribute! 😄 |
* This is the database connection that will be used by the migration and | ||
* the Activity model shipped with this package. | ||
*/ | ||
'database_connection' => env('ACTIVITY_LOGGER_DB_CONNECTION', 'mysql'), |
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.
I wonder if this should default to DB_CONNECTION
instead of mysql
, since a lot of unit tests set only DB_CONNECTION
in phpunit.xml
and therefore test suites will break without explicitly setting this config. Case in point, sqlite :memory: connections.
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.
Good point - now the philosophic question: should we use another env()
in the fallback or just use DB_CONNECTION
?
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.
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.
Thanks @drbyte to pointed out. I was in doubt when I did the pull request but I think this is best solution!
I will think twice about this config. It'll be helpfull for future projects! 👍
Hello, since this change we have an issue on v3.7.1:
this is a breaking change and should have been pushed to v4.0 not to v3.7.1 |
#616 is already open to fix it. Will release it today or tomorrow. I'm sorry for this inconvenience. Until then you can fix an earlier version or add |
I am using a separate database for storing information about activity logs using ACTIVITY_LOGGER_DB_CONNECTION. But once I try to retrieve information about activitylog->causer->name or activitylog->subject->name I am getting an error saying that the base table or view not found in the database I specified in ACTIVITY_LOGGER_DB_CONNECTION which is true, because they are in my "main" database. How to fix this error? |
I hope that Laravel respects the given connections on a relationship. 🤔🧐 Could you check if you can create a test ase to reproduce it? But at all please open a new issue. 😉 |
In case of project with multi database connection, we need the ability to specify the database connection.