mirror of
https://gitee.com/goploy/goploy.git
synced 2024-11-29 18:57:59 +08:00
Fixed: create db if not exists
This commit is contained in:
parent
4d8b3d44c9
commit
be4ee57664
@ -187,11 +187,16 @@ func install() {
|
|||||||
|
|
||||||
println("Start to install the database...")
|
println("Start to install the database...")
|
||||||
|
|
||||||
runner, err := model.Open(cfg.DB)
|
// open connection without database
|
||||||
|
runner, err := model.Open(config.DBConfig{
|
||||||
|
Host: cfg.DB.Host, User: cfg.DB.User, Password: cfg.DB.Password, Port: cfg.DB.Port,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer runner.Close()
|
defer runner.Close()
|
||||||
|
|
||||||
|
// create database if not exists
|
||||||
if err := runner.CreateDB(cfg.DB.Database); err != nil {
|
if err := runner.CreateDB(cfg.DB.Database); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user