20 lines
398 B
Go
20 lines
398 B
Go
|
package initialize
|
||
|
|
||
|
import (
|
||
|
"ginDemo/client"
|
||
|
"ginDemo/model/entity"
|
||
|
"gitee.ltd/lxh/logger"
|
||
|
)
|
||
|
|
||
|
// 初始化数据库表
|
||
|
func databaseTable() {
|
||
|
dbs := []any{
|
||
|
new(entity.User), // 管理员用户
|
||
|
}
|
||
|
|
||
|
if err := client.MySQL.AutoMigrate(dbs...); err != nil {
|
||
|
logger.Say.Panicf("数据库表预初始化处理:%s", err.Error())
|
||
|
}
|
||
|
logger.Say.Debugf("数据库表预初始化处理完成")
|
||
|
}
|