feat: allow setting schema for connection in postgres (#2777)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This PR introduce a new config for database, `database.schema`, allowing user to specify a specific schema to use for their postgres database connection. As the default value is set, it will be backward compatible. Related discussion: https://community.vikunja.io/t/postgres-database-has-error-pq-relation-tasks-does-not-exist/1333 Reviewed-on: #2777 Co-authored-by: John Doe <hugosum.dev@protonmail.com> Co-committed-by: John Doe <hugosum.dev@protonmail.com>
This commit is contained in:
parent
b5cbe99b0a
commit
28d5cd7b28
@ -93,6 +93,7 @@ const (
|
||||
DatabaseSslKey Key = `database.sslkey`
|
||||
DatabaseSslRootCert Key = `database.sslrootcert`
|
||||
DatabaseTLS Key = `database.tls`
|
||||
DatabaseSchema Key = `database.schema`
|
||||
|
||||
TypesenseEnabled Key = `typesense.enabled`
|
||||
TypesenseURL Key = `typesense.url`
|
||||
@ -344,6 +345,7 @@ func InitDefaultConfig() {
|
||||
DatabaseSslKey.setDefault("")
|
||||
DatabaseSslRootCert.setDefault("")
|
||||
DatabaseTLS.setDefault("false")
|
||||
DatabaseSchema.setDefault("public")
|
||||
|
||||
// Typesense
|
||||
TypesenseEnabled.setDefault(false)
|
||||
|
@ -165,6 +165,7 @@ func initPostgresEngine() (engine *xorm.Engine, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
engine.SetSchema(config.DatabaseSchema.GetString())
|
||||
engine.SetMaxOpenConns(config.DatabaseMaxOpenConnections.GetInt())
|
||||
engine.SetMaxIdleConns(config.DatabaseMaxIdleConnections.GetInt())
|
||||
max, err := time.ParseDuration(strconv.Itoa(config.DatabaseMaxConnectionLifetime.GetInt()) + `ms`)
|
||||
|
Loading…
x
Reference in New Issue
Block a user