Add deprecated log when using MySQL with utf8 charset (#19952)

tokarchuk/v1.17
Lunny Xiao 3 years ago committed by GitHub
parent 1a9821f57a
commit 3c6c150740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      modules/setting/database.go

@ -13,6 +13,8 @@ import (
"path/filepath"
"strings"
"time"
"code.gitea.io/gitea/modules/log"
)
var (
@ -83,6 +85,10 @@ func InitDBConfig() {
Database.Schema = sec.Key("SCHEMA").String()
Database.SSLMode = sec.Key("SSL_MODE").MustString("disable")
Database.Charset = sec.Key("CHARSET").In(defaultCharset, []string{"utf8", "utf8mb4"})
if Database.UseMySQL && defaultCharset != "utf8mb4" {
log.Error("Deprecated database mysql charset utf8 support, please use utf8mb4 or convert utf8 to utf8mb4.")
}
Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db"))
Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500)
Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2)

Loading…
Cancel
Save