Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8c0ec89

Browse files
lunnyAbdulrhmnGhanem
authored andcommittedAug 23, 2022
Add deprecated log when using MySQL with utf8 charset (go-gitea#19952)
1 parent 5c901d1 commit 8c0ec89

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎modules/setting/database.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"path/filepath"
1414
"strings"
1515
"time"
16+
17+
"code.gitea.io/gitea/modules/log"
1618
)
1719

1820
var (
@@ -83,6 +85,10 @@ func InitDBConfig() {
8385
Database.Schema = sec.Key("SCHEMA").String()
8486
Database.SSLMode = sec.Key("SSL_MODE").MustString("disable")
8587
Database.Charset = sec.Key("CHARSET").In(defaultCharset, []string{"utf8", "utf8mb4"})
88+
if Database.UseMySQL && defaultCharset != "utf8mb4" {
89+
log.Error("Deprecated database mysql charset utf8 support, please use utf8mb4 or convert utf8 to utf8mb4.")
90+
}
91+
8692
Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db"))
8793
Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500)
8894
Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2)

0 commit comments

Comments
 (0)
Please sign in to comment.