Permalink
Browse files

models: update mySQL charset=utf8mb4 (gogs#4880)

* Add utf8mb4 to connStr for mysql. fix gogs#4131

* Update models.go. charset=utf8mb4 for mysql.

charset=utf8mb4 for mysql.
  • Loading branch information...
m2nlight authored and Unknwon committed Nov 22, 2017
1 parent 3cba877 commit f12c058b78a46bc1da3bf51897a22c65f34091c5
Showing with 2 additions and 2 deletions.
  1. +2 −2 models/models.go
@@ -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=utf8mb4,utf8&parseTime=true",
connStr = fmt.Sprintf("%s:%s@unix(%s)/%s%scharset=utf8mb4&parseTime=true",
DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name, Param)
} else {
connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8mb4,utf8&parseTime=true",
connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8mb4&parseTime=true",
DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name, Param)
}
case "postgres":

0 comments on commit f12c058

Please sign in to comment.