diff options
author | zeripath <art27@cantab.net> | 2020-09-11 10:30:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 10:30:19 +0100 |
commit | e0ac545043d81c9096c161e127a9d4d9e88b1d9f (patch) | |
tree | 9b171681379415afe267a16f4c7059775eea0bab /integrations | |
parent | 25c870faa91954f86951c0e6f7ee25cff1a9869e (diff) | |
download | gitea-e0ac545043d81c9096c161e127a9d4d9e88b1d9f.tar.gz gitea-e0ac545043d81c9096c161e127a9d4d9e88b1d9f.zip |
Add postgres schema to the search_path on database connection (#12634)
Rather than rely on the user running the gitea server and db setting the
schema search_path correctly - if gitea is run with a schema we should
simply set the search_path to have that schema first in the path.
Fix #12505
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/integration_test.go | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go index 36e0682099..3942d54410 100644 --- a/integrations/integration_test.go +++ b/integrations/integration_test.go @@ -198,16 +198,6 @@ func initIntegrationTest() { } } - // Make the user's default search path the created schema; this will affect new connections - if _, err = db.Exec(fmt.Sprintf(`ALTER USER "%s" SET search_path = %s`, setting.Database.User, setting.Database.Schema)); err != nil { - log.Fatalf("db.Exec: ALTER USER SET search_path: %v", err) - } - - // Make the current connection's search the created schema - if _, err = db.Exec(fmt.Sprintf(`SET search_path = %s`, setting.Database.Schema)); err != nil { - log.Fatalf("db.Exec: ALTER USER SET search_path: %v", err) - } - case setting.Database.UseMSSQL: host, port := setting.ParseMSSQLHostPort(setting.Database.Host) db, err := sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", |