mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
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>
This commit is contained in:
committed by
Antoine GIRARD
parent
6d6f1d568e
commit
ad1b6d439f
10
vendor/xorm.io/xorm/session_update.go
generated
vendored
10
vendor/xorm.io/xorm/session_update.go
generated
vendored
@@ -239,14 +239,20 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
|
||||
for i, colName := range exprColumns.colNames {
|
||||
switch tp := exprColumns.args[i].(type) {
|
||||
case string:
|
||||
colNames = append(colNames, session.engine.Quote(colName)+" = "+tp)
|
||||
if len(tp) == 0 {
|
||||
tp = "''"
|
||||
}
|
||||
colNames = append(colNames, session.engine.Quote(colName)+"="+tp)
|
||||
case *builder.Builder:
|
||||
subQuery, subArgs, err := builder.ToSQL(tp)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
colNames = append(colNames, session.engine.Quote(colName)+" = ("+subQuery+")")
|
||||
colNames = append(colNames, session.engine.Quote(colName)+"=("+subQuery+")")
|
||||
args = append(args, subArgs...)
|
||||
default:
|
||||
colNames = append(colNames, session.engine.Quote(colName)+"=?")
|
||||
args = append(args, exprColumns.args[i])
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user