Skip to content

Commit

Permalink
models: add utf8mb4 to connStr for mysql (gogs#4878)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2nlight authored and unknwon committed Nov 21, 2017
1 parent f4ab9f9 commit 67d6728
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ func getEngine() (*xorm.Engine, error) {
switch DbCfg.Type {
case "mysql":
if DbCfg.Host[0] == '/' { // looks like a unix socket
connStr = fmt.Sprintf("%s:%s@unix(%s)/%s%scharset=utf8&parseTime=true",
connStr = fmt.Sprintf("%s:%s@unix(%s)/%s%scharset=utf8mb4,utf8&parseTime=true",
DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name, Param)
} else {
connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8&parseTime=true",
connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8mb4,utf8&parseTime=true",
DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name, Param)
}
case "postgres":
Expand Down

0 comments on commit 67d6728

Please sign in to comment.