提交 0606428c 编写于 作者: W wenxu12345

Merge remote-tracking branch 'origin/tuoyun' into tuoyun

...@@ -35,7 +35,7 @@ func initMysqlDB() { ...@@ -35,7 +35,7 @@ func initMysqlDB() {
} }
//Check the database and table during initialization //Check the database and table during initialization
sql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s ;", config.Config.Mysql.DBDatabaseName+"test1") sql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s default charset utf8 COLLATE utf8_general_ci;", config.Config.Mysql.DBDatabaseName+"test1")
err = db.Exec(sql).Error err = db.Exec(sql).Error
if err != nil { if err != nil {
log.NewError("0", "Exec failed ", err.Error(), sql) log.NewError("0", "Exec failed ", err.Error(), sql)
...@@ -60,6 +60,7 @@ func initMysqlDB() { ...@@ -60,6 +60,7 @@ func initMysqlDB() {
&User{}, &User{},
&Black{}, &ChatLog{}) &Black{}, &ChatLog{})
db.Set("gorm:table_options", "CHARSET=utf8") db.Set("gorm:table_options", "CHARSET=utf8")
db.Set("gorm:table_options", "collation=utf8_unicode_ci")
if !db.HasTable(&Friend{}) { if !db.HasTable(&Friend{}) {
log.NewInfo("CreateTable Friend") log.NewInfo("CreateTable Friend")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册