mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-10 03:56:00 +08:00
set mysql connection
This commit is contained in:
committed by
Xinwei Xiong(cubxxw-openim)
parent
ae86caf39e
commit
5709238c2b
@@ -52,6 +52,15 @@ func initMysqlDB() {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
sqlDB, err := db.DB()
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
sqlDB.SetConnMaxLifetime(time.Second * time.Duration(config.Config.Mysql.DBMaxLifeTime))
|
||||
sqlDB.SetMaxOpenConns(config.Config.Mysql.DBMaxOpenConns)
|
||||
sqlDB.SetMaxIdleConns(config.Config.Mysql.DBMaxIdleConns)
|
||||
|
||||
fmt.Println("open db ok ", dsn)
|
||||
db.AutoMigrate(
|
||||
&Register{},
|
||||
|
||||
Reference in New Issue
Block a user