1
0
Fork 0
forked from forgejo/forgejo

Increase "version" when update the setting value to a same value as before (#28243) (#28244)

Backport #28243

Setting the same value should not trigger DuplicateKey error, and the
"version" should be increased

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit ea9f5a57e4)
This commit is contained in:
Giteabot 2023-11-28 01:58:39 +08:00 committed by Earl Warren
parent ce5260565c
commit b63749b94c
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 13 additions and 1 deletions

View file

@ -81,7 +81,7 @@ func SetSettings(ctx context.Context, settings map[string]string) error {
return err
}
for k, v := range settings {
res, err := e.Exec("UPDATE system_setting SET setting_value=? WHERE setting_key=?", v, k)
res, err := e.Exec("UPDATE system_setting SET version=version+1, setting_value=? WHERE setting_key=?", v, k)
if err != nil {
return err
}