|
@@ -2,16 +2,17 @@ package initialize
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
+ "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
|
|
+ "go.uber.org/zap"
|
|
|
"gorm.io/driver/mysql"
|
|
|
+ "gorm.io/gorm"
|
|
|
"gorm.io/gorm/logger"
|
|
|
"gorm.io/gorm/schema"
|
|
|
+ "lc-fangdaosha/global"
|
|
|
+ "lc-fangdaosha/model/app"
|
|
|
"log"
|
|
|
"os"
|
|
|
"time"
|
|
|
-
|
|
|
- "lc-fangdaosha/global"
|
|
|
-
|
|
|
- "gorm.io/gorm"
|
|
|
)
|
|
|
|
|
|
func Gorm() *gorm.DB {
|
|
@@ -36,6 +37,35 @@ func Gorm() *gorm.DB {
|
|
|
return db
|
|
|
}
|
|
|
}
|
|
|
+func RegisterTables() {
|
|
|
+ db := global.Db
|
|
|
+ err := db.AutoMigrate(
|
|
|
+ system.SysApi{},
|
|
|
+ system.SysUser{},
|
|
|
+ system.SysBaseMenu{},
|
|
|
+ system.JwtBlacklist{},
|
|
|
+ system.SysAuthority{},
|
|
|
+ //system.SysDictionary{},
|
|
|
+ system.SysOperationRecord{},
|
|
|
+ //system.SysAutoCodeHistory{},
|
|
|
+ system.SysDictionaryDetail{},
|
|
|
+ //system.SysBaseMenuParameter{},
|
|
|
+ system.SysBaseMenuBtn{},
|
|
|
+ system.SysAuthorityBtn{},
|
|
|
+ //system.SysAutoCode{},
|
|
|
+ //system.SysChatGptOption{},
|
|
|
+ //example.ExaFile{},
|
|
|
+ //example.ExaCustomer{},
|
|
|
+ //example.ExaFileChunk{},
|
|
|
+ //example.ExaFileUploadAndDownload{},
|
|
|
+ app.Camera{}, app.Picture{}, app.PictureData{}, app.Gateway{}, app.Event{},
|
|
|
+ )
|
|
|
+ if err != nil {
|
|
|
+ global.GVA_LOG.Error("register table failed", zap.Error(err))
|
|
|
+ os.Exit(0)
|
|
|
+ }
|
|
|
+ global.GVA_LOG.Info("register table success")
|
|
|
+}
|
|
|
|
|
|
type DBBASE interface {
|
|
|
GetLogMode() string
|