summaryrefslogtreecommitdiffstats
path: root/routers/install.go
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2020-01-20 12:45:14 -0300
committerAntoine GIRARD <sapk@users.noreply.github.com>2020-01-20 16:45:14 +0100
commitad1b6d439fe0e0875e54227e0bc23a74411f490e (patch)
tree8e16e25a913d167ebb772ad2e0e92cbba9c56b66 /routers/install.go
parent6d6f1d568ec36786b1020f4b43cbd872228c6633 (diff)
downloadgitea-ad1b6d439fe0e0875e54227e0bc23a74411f490e.tar.gz
gitea-ad1b6d439fe0e0875e54227e0bc23a74411f490e.zip
Add support for database schema in PostgreSQL (#8819)
* Add support for database schema * Require setting search_path for the db user * Add schema setting to admin/config.tmpl * Use a schema different from default for psql tests * Update postgres scripts to use custom schema * Update to xorm/core 0.7.3 and xorm/xorm c37aff9b3a * Fix migration test Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/install.go')
-rw-r--r--routers/install.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/routers/install.go b/routers/install.go
index 7395aeee84..e18adfea15 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -54,6 +54,7 @@ func Install(ctx *context.Context) {
form.DbPasswd = setting.Database.Passwd
form.DbName = setting.Database.Name
form.DbPath = setting.Database.Path
+ form.DbSchema = setting.Database.Schema
form.Charset = setting.Database.Charset
ctx.Data["CurDbOption"] = "MySQL"
@@ -147,6 +148,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
setting.Database.User = form.DbUser
setting.Database.Passwd = form.DbPasswd
setting.Database.Name = form.DbName
+ setting.Database.Schema = form.DbSchema
setting.Database.SSLMode = form.SSLMode
setting.Database.Charset = form.Charset
setting.Database.Path = form.DbPath
@@ -267,6 +269,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
cfg.Section("database").Key("NAME").SetValue(setting.Database.Name)
cfg.Section("database").Key("USER").SetValue(setting.Database.User)
cfg.Section("database").Key("PASSWD").SetValue(setting.Database.Passwd)
+ cfg.Section("database").Key("SCHEMA").SetValue(setting.Database.Schema)
cfg.Section("database").Key("SSL_MODE").SetValue(setting.Database.SSLMode)
cfg.Section("database").Key("CHARSET").SetValue(setting.Database.Charset)
cfg.Section("database").Key("PATH").SetValue(setting.Database.Path)