123456789101112131415161718192021222324 |
- package dao
- import (
- "fmt"
- "gorm.io/gorm"
- )
- var Db *gorm.DB
- func InitDB(db *gorm.DB) {
- Db = db
- err := Db.AutoMigrate(
- &User{},
- &Dict{},
- &Tenant{},
- &Role{},
- &RoleMenu{},
- &Menu{},
- &OperationHistory{},
- )
- if err != nil {
- panic(fmt.Sprintf("AutoMigrate err : %v", err))
- }
- }
|