This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package initialize
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/plugin/wechat-integration/model"
|
||||
)
|
||||
|
||||
// Gorm 初始化数据库表
|
||||
func Gorm(ctx context.Context) {
|
||||
// 自动迁移数据库表
|
||||
err := global.GVA_DB.WithContext(ctx).AutoMigrate(
|
||||
&model.WechatMiniUser{},
|
||||
&model.MpUser{},
|
||||
&model.MpMessage{},
|
||||
&model.MpMenu{},
|
||||
&model.MpAutoReply{},
|
||||
&model.MpMaterial{},
|
||||
&model.MpNews{},
|
||||
&model.MpConfig{},
|
||||
&model.MpWebhookLog{},
|
||||
&model.MpDraft{},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("微信集成插件数据库表迁移失败: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
global.GVA_LOG.Info("微信集成插件数据库表迁移完成")
|
||||
}
|
||||
Reference in New Issue
Block a user