We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Version: v2.7.0
Hello, is there a way override basic Gorm settings in the global database connection scope, for example auto_preload feature?
auto_preload
The text was updated successfully, but these errors were encountered:
Hello!
database.GetConnection() returns *gorm.DB, so you can use it in the same way as you normally would.
database.GetConnection()
*gorm.DB
I think you were thinking about this kind of setting ?
database.GetConnection().Set("gorm:auto_preload", true)
You can make your configuration changes before starting the server:
func configureDatabase() { db := database.GetConnection() db.Set("gorm:auto_preload", true) // Other settings... } func main() { configureDatabase() goyave.Start(route.Register) }
Be careful though, if the database.Close() method is called, your settings will be gone.
database.Close()
Sorry, something went wrong.
Maybe i can handle it in some kind of middleware, because of the database.Close() thing, thank you for your response!
Add db connection initializers #98
7062941
No branches or pull requests
Support
Version: v2.7.0
Hello, is there a way override basic Gorm settings in the global database connection scope, for example
auto_preload
feature?The text was updated successfully, but these errors were encountered: