package db import ( "go.uber.org/zap" "Medical_OAuth/app/admin/model" mycasbin "gogs.baozhida.cn/zoie/OAuth-core/pkg/casbin" ) // 执行数据迁移 func AutoMigrateDB() { //自动迁移模式 err := DB.Set("gorm:table_options", "charset=utf8mb4"). AutoMigrate( &mycasbin.CasbinRule{}, &model.SysService{}, &model.SysUser{}, &model.SysRole{}, //&model.ServMenu{}, //&model.ServApi{}, //&model.ServRoleApi{}, //&model.SysRoleMenu{}, //&model.SysMenu{}, &model.SysDept{}, //&model.SysPost{}, //&model.SysRegisterAuth{}, //&model.SysDictData{}, //&model.SysDictType{}, &model.SysLoginLog{}, &model.SysOperaLog{}, &model.SysConfig{}, //&jobsModel.SysJob{}, ) if err != nil { zap.L().Panic("migrate db fail", zap.Error(err)) } }