33 lines
728 B
Go
33 lines
728 B
Go
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.MiniUser{},
|
|
&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("微信集成插件数据库表迁移完成")
|
|
}
|