-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Way to test db connection #545
Comments
+1 |
1 similar comment
+1 |
For people finding this issue, this is easy enough to do manually now: |
There is also a library that provides this functionality (with preset test queries for different dbs) out of the box: https://www.npmjs.com/package/knex-utils |
I think this can be closed or the use case needs to be specified more clearly. Currently one can easily test the connection by just making some dummy query to the DB. That guarantees, that connection is available at that moment, but of course connection may be broken in next moment after the check. |
Hello, This issue should be reopened and a connection method should be implemented. Thanks |
@KaKi87 nope. This should not be reopened and I have no idea what you mean by connection method 🤷♂ Please open a feature request if there is a new feature that you would like knex to have. |
The connection status should be logged in the console. Query some dummy data from database is a workaround, not the solution. |
@elhigu A connection method can be a method called |
@yumindeckard you can add event handlers to tarn to log that kind of stuff. There are events telling if connection acquire fails for example and many other. Also if you need to log connection status on knex side you can add @KaKi87 Making query is the only way to check if you are able to access your DB and having If you need that kind of method knex nowadays offers API to add extensions so you can write separate knex-plugin for that method or you can just use EDIT: |
Would be useful...
The text was updated successfully, but these errors were encountered: