diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-06-13 20:55:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-13 20:55:08 +0800 |
commit | 3c6c1507403b659a9ed790df19311a9f83175364 (patch) | |
tree | 03bb08d9de7f1b7858bda14097cb80d7968ea762 /modules/setting/database.go | |
parent | 1a9821f57a0293db3adc0eab8aff08ca5fa1026c (diff) | |
download | gitea-3c6c1507403b659a9ed790df19311a9f83175364.tar.gz gitea-3c6c1507403b659a9ed790df19311a9f83175364.zip |
Add deprecated log when using MySQL with utf8 charset (#19952)
Diffstat (limited to 'modules/setting/database.go')
-rw-r--r-- | modules/setting/database.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/setting/database.go b/modules/setting/database.go index 5be2d8deea..a90ace5b4b 100644 --- a/modules/setting/database.go +++ b/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) |