feat: database init when base-info install

This commit is contained in:
LinkinStar 2022-11-09 14:46:22 +08:00
parent fa3838b604
commit e81d9cfedd
1 changed files with 6 additions and 6 deletions

View File

@ -126,12 +126,6 @@ func InitEnvironment(ctx *gin.Context) {
handler.HandleResponse(ctx, errors.BadRequest(reason.ReadConfigFailed), nil)
return
}
if err := migrations.InitDB(c.Data.Database); err != nil {
log.Error("init database error: ", err.Error())
handler.HandleResponse(ctx, errors.BadRequest(reason.DatabaseConnectionFailed), schema.ErrTypeAlert)
return
}
handler.HandleResponse(ctx, nil, nil)
}
@ -157,6 +151,12 @@ func InitBaseInfo(ctx *gin.Context) {
return
}
if err := migrations.InitDB(c.Data.Database); err != nil {
log.Error("init database error: ", err.Error())
handler.HandleResponse(ctx, errors.BadRequest(reason.DatabaseConnectionFailed), schema.ErrTypeAlert)
return
}
err = migrations.UpdateInstallInfo(c.Data.Database, req.Language, req.SiteName, req.SiteURL, req.ContactEmail,
req.AdminName, req.AdminPassword, req.AdminEmail)
if err != nil {